- 博客(79)
- 收藏
- 关注
原创 [LeetCode] Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.
2014-09-04 13:32:40 417
原创 [LeetCode] Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.
2014-09-04 13:23:25 419
原创 [LeetCode] Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".
2014-09-04 12:58:52 426
原创 [LeetCode] Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
2014-09-04 12:32:56 301
原创 [LeetCode] Valid Sudoku Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of
2014-09-02 13:13:12 308
原创 [LeetCode] Valid Sudoku
Valid Sudoku Total Accepted: 12421 Total Submissions: 44620
2014-08-26 03:57:03 348
原创 [LeetCode] Search in Rotated Sorted Array II
Search in Rotated Sorted Array II Total Accepted: 14625 Total Submissions: 47745Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-
2014-08-25 23:44:09 323
原创 [LeetCoed] Longest Consecutive Sequence
Longest Consecutive Sequence Total Accepted: 17029 Total Submissions: 61041My SubmissionsGiven an unsorted array of integers, find the length of the longest consecutive elements sequence
2014-08-15 12:18:50 347
原创 [LeetCode] Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe
2014-05-12 11:22:14 397
原创 [LeetCode] 3Sum
Total Accepted: 12950 Total Submissions: 78829Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the s
2014-05-12 10:53:02 570
原创 [LeetCode] 3Sum Closest
Total Accepted: 9118 Total Submissions: 33975Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three intege
2014-05-12 10:29:42 399
原创 [LeetCode] Trapping Rain Water
Total Accepted: 8508 Total Submissions: 30322Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raini
2014-05-09 13:48:24 425
原创 [LeetCode] Length of Last Word
Total Accepted: 9937 Total Submissions: 35192Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the las
2014-05-09 10:57:19 432
原创 [LeetCode] Palindrome Number
Total Accepted: 12012 Total Submissions: 41212Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be p
2014-05-09 10:50:14 469
原创 [LeetCode] Binary Tree Level Order Traversal II
Total Accepted: 9875 Total Submissions: 31987Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
2014-05-08 11:05:52 357
原创 [LeetCode] Binary Tree Level Order Traversal
Total Accepted: 12041 Total Submissions: 39526Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary
2014-05-08 10:29:24 514
原创 [LeetCode] Sort Colors
Total Accepted: 12661 Total Submissions: 40912Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order r
2014-05-08 09:58:30 420
原创 [LeetCode] Gray Code
Total Accepted: 8909 Total Submissions: 28265The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the tot
2014-05-07 18:28:00 377
原创 [LeetCode] Valid Parentheses
Total Accepted: 10415 Total Submissions: 37624Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must clos
2014-05-07 17:58:39 382
原创 [LeetCode] Swap Nodes in Pairs
Total Accepted: 12160 Total Submissions: 38223Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->
2014-05-07 17:43:47 355
原创 [LeetCode] Spiral Matrix II
Total Accepted: 7483 Total Submissions: 24801Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return th
2014-05-07 13:38:23 379
原创 [LeetCode] Roman to Integer
Total Accepted: 8261 Total Submissions: 25407Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public in
2014-05-06 18:33:40 299
原创 [LeetCode] Integer to Roman
Total Accepted: 7867 Total Submissions: 24270Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.
2014-05-06 18:08:13 342
原创 [LeetCode] Minimum Path Sum
Total Accepted: 9358 Total Submissions: 30791Given 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 pat
2014-05-05 18:28:50 368
原创 [LeetCode] Balanced Binary Tree
Total Accepted: 13112 Total Submissions: 41069Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which t
2014-05-05 18:06:21 433
原创 [LeetCode] N-Queens II
Total Accepted: 6667 Total Submissions: 21387Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.
2014-05-04 18:08:27 1144
原创 [LeetCode] Letter Combinations of a Phone Number
Total Accepted: 8862 Total Submissions: 34390
2014-05-02 01:13:14 711
原创 [LeetCode] Reverse Integer
Total Accepted: 16633 Total Submissions: 41800Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought abo
2014-04-30 18:25:27 575
原创 [LeetCode] Generate Parentheses
Total Accepted: 10863 Total Submissions: 35390Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution se
2014-04-30 18:10:03 357
原创 [LeetCode] Combination Sum II
Total Accepted: 7633 Total Submissions: 31949Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
2014-04-30 17:57:43 489
原创 [LeetCode] Best Time to Buy and Sell Stock III
Total Accepted: 7877 Total Submissions: 35958Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may
2014-04-30 11:27:44 421
原创 [LeetCode] Best Time to Buy and Sell Stock II
Total Accepted: 12408 Total Submissions: 34893
2014-04-30 10:10:56 343
原创 [LeetCode] Best Time to Buy and Sell Stock
Total Accepted: 12576 Total Submissions: 41038Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one tran
2014-04-30 09:52:57 498
原创 [LeetCode] Combination Sum
Total Accepted: 9767 Total Submissions: 37455Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeat
2014-04-28 17:58:18 405
原创 [LeetCode] Subsets II
Total Accepted: 8828 Total Submissions: 32877Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending
2014-04-28 14:30:33 373
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人