题目链接:https://leetcode.com/problems/merge-two-sorted-lists/
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first
two...
分类:
其他好文 时间:
2015-07-14 15:35:59
阅读次数:
111
https://leetcode.com/problems/implement-strstr/题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle ...
分类:
其他好文 时间:
2015-07-14 15:23:11
阅读次数:
131
题目链接:https://leetcode.com/problems/4sum/
依次将问题转化为3Sum、2Sum问题, 后两个问题解法见关联博文。
/**
* Return an array of arrays of size *returnSize.
* Note: The returned array must be malloced, assume caller calls fr...
分类:
其他好文 时间:
2015-07-14 13:43:05
阅读次数:
109
@requires_authorization
@author johnsondu
@create_time 2015.7.13 11:03
@url [valid parentheses](https://leetcode.com/problems/valid-parentheses/)
/*****************
* 类别: 栈模拟判断
* 时间复杂度: O(n)
* 空间复杂度...
分类:
其他好文 时间:
2015-07-14 11:22:05
阅读次数:
97
https://leetcode.com/problems/sort-colors/计数排序问题 1 class Solution { 2 public: 3 void sortColors(vector& nums) { 4 int rates[3]={0}; 5 ...
分类:
其他好文 时间:
2015-07-14 11:16:22
阅读次数:
127
出现:Rendering Problemsthe following classes could not be found:android.support.v7.internal.widget.ActionBarOverlayLayout (Fix Build Path, Edit XML, Cre...
分类:
移动开发 时间:
2015-07-13 18:11:41
阅读次数:
256
https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * ...
分类:
其他好文 时间:
2015-07-13 17:36:27
阅读次数:
79
https://leetcode.com/problems/maximum-subarray/动态规划:用res数组来记录包含了每个点的连续数组的和的最大的情况解的情况,后续的每次计算参考前面的计算结果。 1 class Solution { 2 public: 3 int maxSubAr...
分类:
其他好文 时间:
2015-07-13 17:34:41
阅读次数:
89
https://leetcode.com/problems/gray-code/ 1 class Solution { 2 public: 3 vector grayCode(int n) { 4 vector res; 5 if(n==0) 6 ...
分类:
其他好文 时间:
2015-07-13 15:38:50
阅读次数:
95
https://leetcode.com/problems/search-a-2d-matrix/ 1 class Solution { 2 public: 3 bool searchMatrix(vector>& matrix, int target) { 4 int m=...
分类:
其他好文 时间:
2015-07-13 15:26:33
阅读次数:
93