上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 62 下一页
摘要: 首先是next permutation的算法的描述和分析如下: 这题一是要知道思路,编程中注意STL的用法 void nextPermutaion(vector<int> &num) { next_permutation(num.begin(), num.end()); } private: tem 阅读全文
posted @ 2016-05-15 15:34 牧马人夏峥 阅读(236) 评论(0) 推荐(0)
摘要: 第一题是Two Sum 同样是用哈希表来做,需要注意的是在查打gap是要排除本身。比如target为4,有一个值为2,gap同样为2。 vector<int> twoSum(vector<int> &num, int target) { unordered_map<int, int> mapping 阅读全文
posted @ 2016-05-14 15:02 牧马人夏峥 阅读(232) 评论(0) 推荐(0)
摘要: 这题要仔细体会下哈希表的用法,要注意的是数组本身是无序的,因此需要向左右进行扩张。 另外这个思路可以进行聚类,把连续的标记为一类。 int longestConsecutive(const vector<int> &num) { unordered_map<int, bool> used; for 阅读全文
posted @ 2016-05-14 14:22 牧马人夏峥 阅读(139) 评论(0) 推荐(0)
摘要: 找两个排好序的数组的中间值,实际上可以扩展为寻找第k大的数组值。 参考下面的思路,非常的清晰: 代码: double findMedianofTwoSortArrays(int A[], int B[], int m, int n) { int total = m + n; //判断序列长度的奇偶, 阅读全文
posted @ 2016-05-14 13:31 牧马人夏峥 阅读(143) 评论(0) 推荐(0)
摘要: 描述 Follow up for ”Search in Rotated Sorted Array”: What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a fun 阅读全文
posted @ 2016-05-01 21:34 牧马人夏峥 阅读(138) 评论(0) 推荐(0)
摘要: 描述 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target 阅读全文
posted @ 2016-05-01 21:10 牧马人夏峥 阅读(138) 评论(0) 推荐(0)
摘要: 描述 Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice? For example, Given sorted array A = [1,1,1,2,2,3], Your function s 阅读全文
posted @ 2016-05-01 20:30 牧马人夏峥 阅读(124) 评论(0) 推荐(0)
摘要: 删除数组中的重复元素并返回新数组的个数 思路:保留不同的元素即可。 阅读全文
posted @ 2016-05-01 19:56 牧马人夏峥 阅读(122) 评论(0) 推荐(0)
摘要: 这篇论文主要讲了CNN的很多技巧,参考这位博主的笔记:http://blog.csdn.net/whiteinblue/article/details/43202399 https://blog.acolyer.org/2016/04/20/imagenet-classification-with- 阅读全文
posted @ 2016-04-24 09:25 牧马人夏峥 阅读(276) 评论(0) 推荐(0)
摘要: 卷积网络 卷积网络用三种结构来确保移位、尺度和旋转不变:局部感知野、权值共享和时间或空间降采样。典型的leNet-5如下图所示: C1中每个特征图的每个单元和输入的25个点相连,这个5*5的区域被称为感知野。特征图的每个单元共享25个权值和一个偏置。其他特征图使用不同的权值(卷积枋),因 此可以得到 阅读全文
posted @ 2016-04-23 16:04 牧马人夏峥 阅读(3779) 评论(0) 推荐(0)
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 62 下一页