随笔分类 -  leetcode

1 2 3 4 5 ··· 7 下一页
摘要:Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm... 阅读全文
posted @ 2015-02-08 23:31 birdhack 阅读(119) 评论(0) 推荐(0)
摘要:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be on... 阅读全文
posted @ 2015-02-02 22:21 birdhack 阅读(141) 评论(0) 推荐(0)
摘要:Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文
posted @ 2015-01-30 22:42 birdhack 阅读(126) 评论(0) 推荐(0)
摘要:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni... 阅读全文
posted @ 2015-01-28 23:19 birdhack 阅读(129) 评论(0) 推荐(0)
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t... 阅读全文
posted @ 2015-01-27 20:41 birdhack 阅读(146) 评论(0) 推荐(0)
摘要:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions. 1 public class Solution { ... 阅读全文
posted @ 2015-01-23 22:05 birdhack 阅读(141) 评论(0) 推荐(0)
摘要:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc... 阅读全文
posted @ 2015-01-23 00:20 birdhack 阅读(111) 评论(0) 推荐(0)
摘要:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?可以找规律 得出映射关系,(i,j)=... 阅读全文
posted @ 2015-01-21 22:54 birdhack 阅读(120) 评论(0) 推荐(0)
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2015-01-19 00:41 birdhack 阅读(167) 评论(0) 推荐(0)
摘要:Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18]. 1 /** 2 * De... 阅读全文
posted @ 2015-01-16 22:40 birdhack 阅读(87) 评论(0) 推荐(0)
摘要:Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.... 阅读全文
posted @ 2015-01-15 23:40 birdhack 阅读(106) 评论(0) 推荐(0)
摘要: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 formed num... 阅读全文
posted @ 2015-01-14 23:54 birdhack 阅读(239) 评论(0) 推荐(0)
摘要:Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru... 阅读全文
posted @ 2015-01-12 21:59 birdhack 阅读(133) 评论(0) 推荐(0)
摘要:Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.使用两个指... 阅读全文
posted @ 2015-01-12 21:23 birdhack 阅读(123) 评论(0) 推荐(0)
摘要:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT. 1 public class Solution { 2 public ... 阅读全文
posted @ 2015-01-11 23:05 birdhack 阅读(123) 评论(0) 推荐(0)
摘要:Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with ... 阅读全文
posted @ 2015-01-08 23:41 birdhack 阅读(124) 评论(0) 推荐(0)
摘要:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-... 阅读全文
posted @ 2015-01-07 22:42 birdhack 阅读(141) 评论(0) 推荐(0)
摘要:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret... 阅读全文
posted @ 2015-01-06 23:11 birdhack 阅读(116) 评论(0) 推荐(0)
摘要:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number ... 阅读全文
posted @ 2015-01-05 22:28 birdhack 阅读(146) 评论(0) 推荐(0)
摘要:Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest... 阅读全文
posted @ 2015-01-01 20:43 birdhack 阅读(138) 评论(0) 推荐(0)

1 2 3 4 5 ··· 7 下一页