随笔分类 -  [LeetCode]

摘要:Problem:Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have... 阅读全文
posted @ 2015-08-27 12:43 airforce 阅读(192) 评论(0) 推荐(0)
摘要:Problem:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded messa... 阅读全文
posted @ 2015-08-27 09:56 airforce 阅读(452) 评论(0) 推荐(0)
摘要:Problem:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounde... 阅读全文
posted @ 2015-08-27 06:03 airforce 阅读(150) 评论(0) 推荐(0)
摘要:Problem:Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in th... 阅读全文
posted @ 2015-08-27 03:42 airforce 阅读(158) 评论(0) 推荐(0)
摘要:Problem:Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], the largest fo... 阅读全文
posted @ 2015-08-26 12:09 airforce 阅读(141) 评论(0) 推荐(0)
摘要:Problem:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes us... 阅读全文
posted @ 2015-08-26 10:51 airforce 阅读(153) 评论(0) 推荐(0)
摘要:Problem:Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting a... 阅读全文
posted @ 2015-08-26 09:33 airforce 阅读(133) 评论(0) 推荐(0)
摘要:Problem:Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0, 1,... 阅读全文
posted @ 2015-08-26 04:29 airforce 阅读(823) 评论(0) 推荐(0)
摘要:Problem:Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (incl... 阅读全文
posted @ 2015-08-26 02:53 airforce 阅读(189) 评论(0) 推荐(0)
摘要:Problem:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The ... 阅读全文
posted @ 2015-08-25 00:41 airforce 阅读(157) 评论(0) 推荐(0)
摘要:Problem: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="ADO... 阅读全文
posted @ 2015-08-24 23:28 airforce 阅读(164) 评论(0) 推荐(0)
摘要:Problem:Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from ... 阅读全文
posted @ 2015-08-24 04:30 airforce 阅读(181) 评论(0) 推荐(0)
摘要:Problem:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted arraynums=[1,1,1,2,2,3],Your function s... 阅读全文
posted @ 2015-08-23 12:36 airforce 阅读(121) 评论(0) 推荐(0)
摘要:Problem:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For exam... 阅读全文
posted @ 2015-08-23 00:32 airforce 阅读(230) 评论(0) 推荐(0)
摘要:Problem:Given a collection of integers that might contain duplicates,nums, return all possible subsets.Note:Elements in a subset must be in non-descen... 阅读全文
posted @ 2015-08-22 12:25 airforce 阅读(197) 评论(0) 推荐(0)
摘要:Problem:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following uni... 阅读全文
posted @ 2015-08-22 04:15 airforce 阅读(173) 评论(0) 推荐(0)
摘要:Problem:Find all possible combinations ofknumbers that add up to a numbern, given that only numbers from 1 to 9 can be used and each combination shoul... 阅读全文
posted @ 2015-08-22 01:07 airforce 阅读(166) 评论(0) 推荐(0)
摘要:Problem:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each... 阅读全文
posted @ 2015-08-21 23:49 airforce 阅读(155) 评论(0) 推荐(0)
摘要:Problem:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.link:https://leetco... 阅读全文
posted @ 2015-08-21 10:37 airforce 阅读(142) 评论(0) 推荐(0)
摘要:Problem:The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequ... 阅读全文
posted @ 2015-08-21 06:10 airforce 阅读(229) 评论(0) 推荐(0)