摘要: class Solution {public: int removeDuplicates(int A[], int n) { int temp = A[0],j = 0,count; for(int i = 0 ; i =2) A[j++] = temp; ... 阅读全文
posted @ 2015-03-29 21:44 SprayT 阅读(66) 评论(0) 推荐(0)
摘要: /*水题*/class Solution {public: int removeDuplicates(int A[], int n) { int temp = A[0],j = 0; for(int i = 0 ; i < n ;){ whil... 阅读全文
posted @ 2015-03-29 21:37 SprayT 阅读(87) 评论(0) 推荐(0)
摘要: /*写了个快排,但这肯定不是最优的解法,果然有O(n)的相当于快排的partition部分*/class Solution {public: void Qsort(int A[],int l,int r){ if(l>=r) return; int x = A[l]... 阅读全文
posted @ 2015-03-29 21:31 SprayT 阅读(122) 评论(0) 推荐(0)
摘要: /*简单二分*/class Solution {public: int searchInsert(int A[], int n, int target) { int l = 0,r = n-1,mid ; while(ltarget) r = mid-1; ... 阅读全文
posted @ 2015-03-29 20:34 SprayT 阅读(84) 评论(0) 推荐(0)
摘要: /* 简单dp,转态转移方程dp[i][j] = dp[i-1][j]+dp[i][j-1];初始化下边界*/class Solution {public: int uniquePaths(int m, int n) { if(m<0||n<0) return 0; ... 阅读全文
posted @ 2015-03-29 20:13 SprayT 阅读(85) 评论(0) 推荐(0)