摘要: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BANC".Note:If there is no such window in S that covers all characters in T, return the 阅读全文
posted @ 2012-09-29 03:53 ETCOW 阅读(356) 评论(0) 推荐(0) 编辑
摘要: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at any point in time.递归: 1 public static int MinimumPathSum(List<List<int>> grid) 2 { 3 ... 阅读全文
posted @ 2012-09-29 03:32 ETCOW 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 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 lists. 1 public static ListNode MergeTwoSortedLists(ListNode A, ListNode B) 2 { 3 if (A == null) 4 return B; 5 ... 阅读全文
posted @ 2012-09-29 00:26 ETCOW 阅读(325) 评论(0) 推荐(0) 编辑