随笔分类 - leetcode
摘要:Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is...
阅读全文
摘要: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],...
阅读全文
摘要: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...
阅读全文
摘要:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ...
阅读全文
摘要: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 =...
阅读全文
摘要:题目如下:一个全是32位整数的大数组,除了其中一个数字出现2次外,其余的数字都出现了3次。如何找出那个只出现了两次的数字? 1 int singleNumber3(int a[], int length){ 2 int ones = 0; 3 int twos = 0; 4 ...
阅读全文

浙公网安备 33010602011771号