摘要:
Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining character 阅读全文
摘要:
Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.嗯……没啥好说的…… 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; 8 *... 阅读全文
摘要:
TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,5,7], [4,1,8,3]]The minimum path sum from top to bottom is11(i.e.,2+3+5+1= 11).Note:Bonus point if y... 阅读全文