自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Nick

亘古而常青的昨天永远是过去,也永远会再来。

  • 博客(15)
  • 收藏
  • 关注

转载 215. Kth Largest Element in an Array(数组中第k大的数字)

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.Note:

2017-08-27 22:54:49 267

转载 三种快速排序算法的实现(递归算法、非递归算法、三路划分快速排序)

转载 http://blog.csdn.net/yunzhongguwu005/article/details/9455991

2017-08-27 22:51:38 520

原创 拼多多2018校招内推编程题汇总

[编程题] 最大乘积时间限制:1秒 空间限制:32768K给定一个无序数组,包含正数、负数和0,要求从中找出3个数的乘积,使得乘积最大,要求时间复杂度:O(n),空间复杂度:O(1) 输入描述: 无序整数数组A[n]输出描述: 满足条件的最大乘积输入例子1: 3 4 1 2输出例子1: 24#include <iostream>#include <algorithm>#include

2017-08-13 21:56:16 718

转载 遍历二叉树

一、前序遍历前序遍历简单来讲,遍历顺序是:根节点-左子树-右子树1、递归遍历1 void preorder(BinTree *T)2 {3 if(T==NULL)4 return;5 cout << T->data;6 preorder(T->left);7 preorder(T->right);8 }2、迭代遍历(用栈实现) 1

2017-08-12 14:19:41 295

原创 207 Course Schedule (课程清单)

There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair:

2017-08-11 11:46:49 296

原创 206 Reverse Linked List

Reverse a singly linked list.程序如下:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class So

2017-08-10 10:17:34 195

转载 多标签图像分类任务的评价方法-mAP

多标签图像分类(Multi-label   Image Classification)任务中图片的标签不止一个,因此评价不能用普通单标签图像分类的标准,即mean accuracy,该任务采用的是和信息检索中类似的方法—mAP(mean Average Precision)。mAP虽然字面意思和mean accuracy看起来差不多,但是计算方法要繁琐得多,以下是mAP的计算方法:首先用训

2017-08-09 21:27:21 1123 1

原创 200 Number of Islands(岛屿数量)

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume

2017-08-09 10:45:10 264

原创 198/213/337 House Robber

198 House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is th

2017-08-08 11:21:07 296

原创 169/229 Majority Element(寻找众数)

169 Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and

2017-08-07 18:09:51 327

原创 160 Intersection of Two Linked Lists 求两个链表的交点

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2017-08-05 12:17:59 342

原创 53/152 Maximum Product Subarray /Maximum Subarray(子序列之 和/积 最大)

53 Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has

2017-08-04 10:30:52 218

原创 148 Sort List (归并实现链表排序)

Sort a linked list in O(n log n) time using constant space complexity. 常见排序方法有很多,插入排序,选择排序,堆排序,快速排序,冒泡排序,归并排序,桶排序等等。。它们的时间复杂度不尽相同,而这里题目限定了时间必须为O(nlgn),符合要求只有快速排序,归并排序,堆排序,而根据单链表的特点,最适于用归并排序。代码如下:/**

2017-08-03 10:29:20 472

原创 106/107/108 Convert * to Binary Search Tree 组转为二叉搜索树

108 Convert Sorted Array to Binary Search Tree 将有序数组转为二叉搜索树Given an array where elements are sorted in ascending order, convert it to a height balanced BST.这道题是要将有序数组转为二叉搜索树,所谓二叉搜索树,是一种始终满足左<根<右的特性,如果将

2017-08-02 10:32:26 498

原创 136/137/260 Single Number

136 Single Number Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it wi

2017-08-01 17:50:15 286

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除