随笔分类 -  leetcode

摘要:解析: 阅读全文
posted @ 2016-04-08 11:32 舒克_贝塔 阅读(161) 评论(0) 推荐(0)
摘要:Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is... 阅读全文
posted @ 2015-09-12 11:42 舒克_贝塔 阅读(105) 评论(0) 推荐(0)
摘要:Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],... 阅读全文
posted @ 2015-09-10 20:54 舒克_贝塔 阅读(151) 评论(0) 推荐(0)
摘要:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文
posted @ 2015-09-10 10:37 舒克_贝塔 阅读(145) 评论(0) 推荐(0)
摘要:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2015-09-10 09:22 舒克_贝塔 阅读(112) 评论(0) 推荐(0)
摘要:1 bool is_sqrt(int n){ 2 for(int i=1;i=i/2;--j){23 a[i] = a[i]<(a[j]+a[i-j])?a[i]:(a[j]+a[i-j]);24 }25 }26 int temp =... 阅读全文
posted @ 2015-09-10 08:20 舒克_贝塔 阅读(724) 评论(0) 推荐(0)
摘要:题目如下:一个全是32位整数的大数组,除了其中一个数字出现2次外,其余的数字都出现了3次。如何找出那个只出现了两次的数字? 1 int singleNumber3(int a[], int length){ 2 int ones = 0; 3 int twos = 0; 4 ... 阅读全文
posted @ 2015-08-26 16:08 舒克_贝塔 阅读(178) 评论(0) 推荐(0)