Solution set for LeetCode.com.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 16 commits behind zwxxx:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
3Sum.cpp
3Sum_Closest.cpp
4Sum.cpp
Add_Binary.cpp
Add_Two_Number.cpp
Anagrams.cpp
Climbing_Stairs.cpp
Combination_Sum.cpp
Combination_Sum_II.cpp
Combination_Sum_II_faster.cpp
Combination_Sum_faster.cpp
Combinations.cpp
Container_With_Most_Water.cpp
Convert_Sorted_List_To_Binary_Search_Tree.cpp
Count_and_Say.cpp
Decode_Ways.cpp
Divide_Two_Integers.cpp
Edit_Distance.cpp
First_Missing_Positive.cpp
Flatten_Binary_Tree_to_Linked_List.cpp
Generate_Parentheses.cpp
Gray_Code.cpp
Implement_strStr.cpp
Insert_Interval.cpp
Integer_to_Roman.cpp
Interleaving_String.cpp
Jump_Game.cpp
Jump_Game_II.cpp
Largest_Rectangle_in_Histogram.cpp
Length_of_Last_Word.cpp
Letter_Combinations_of_a_Phone_Number.cpp
Longest_Common_Prefix.cpp
Longest_Palindromic_Substring.cpp
Longest_Substring_Without_Repeating_Characters.cpp
Longest_Valid_Parentheses.cpp
Main.cpp
Maximal_Rectangle.cpp
Maximal_Rectangle_faster.cpp
Maximum_Subarray.cpp
Median_of_Two_Sorted_Arrays.cpp
Merge_Intervals.cpp
Merge_Sorted_Array.cpp
Merge_Two_Sorted_Lists.cpp
Merge_k_Sorted_Lists.cpp
Minimum_Path_Sum.cpp
Minimum_Window_Substring.cpp
Multiply_Strings.cpp
N-Queens.cpp
N-Queens_II.cpp
Next_Permutation.cpp
Palindrome_Number.cpp
Partition_List.cpp
Permutation_Sequence.cpp
Permutations.cpp
Permutations_II.cpp
Plus_One.cpp
README
Regular_Expression_Matching.cpp
Remove_Duplicates_from_Sorted_Array.cpp
Remove_Duplicates_from_Sorted_Array_II.cpp
Remove_Duplicates_from_Sorted_List.cpp
Remove_Duplicates_from_Sorted_List_II.cpp
Remove_Element.cpp
Remove_Nth_Node_From_End_of_List.cpp
Reverse_Integer.cpp
Reverse_Linked_List_II.cpp
Reverse_Nodes_in_k-Group.cpp
Roman_to_Integer.cpp
Rotate_Image.cpp
Rotate_List.cpp
Scramble_String.cpp
Search_Insert_Position.cpp
Search_a_2D_Matrix.cpp
Search_for_a_Range.cpp
Search_in_Rotated_Sorted_Array.cpp
Search_in_Rotated_Sorted_Array_II.cpp
Set_Matrix_Zeroes.cpp
Simplify_Path.cpp
Sort_Colors.cpp
Spiral_Matrix.cpp
Spiral_Matrix_II.cpp
Sqrt.cpp
String_to_Integer_(atoi).cpp
Subsets.cpp
Subsets_II.cpp
Substring_with_Concatenation_of_All_Words.cpp
Sudoku_Solver.cpp
Swap_Nodes_in_Pairs.cpp
Text_Justification.cpp
Trapping_Rain_Water.cpp
Two_Sum.cpp
Unique_Paths.cpp
Unique_Paths_II.cpp
Valid_Number.cpp
Valid_Parentheses.cpp
Valid_Sudoku.cpp
Wildcard_Matching.cpp
Word_Search.cpp
ZigZag_Conversion.cpp
pow.cpp

README

Solution set for Leetcode online interview problems. (88/92)
http://www.leetcode.com/onlinejudge
My purpose of publishing the solution set is 
1) preparing for the technical interviews;
2) looking forward better ideas and more elegant code to solve the problem.

3 Sum: medium
3 Sum Closest: medium
4 Sum: Is there a solution that the time complexity is better than O(n^2 * lgn)?
Add Binary: medium
Add Two Numbers: easy
Anagrams: easy
Climbing Stairs: medium
Combination Sum: Is there a better way to construct the path?
Combination Sum II: Is ther a better way to construct the path?
Combinations: easy

Container With Most Water: hard
Count and Say: easy
Decode Ways: dp
Divide Two Integers: easy
Edit Distance: dp
First Missing Positive: easy
Generate Parentheses: easy
Gray Code: bit operation
Implement strStr(): easy
Insert Interval: easy

Integer to Roman: easy
Jump Game: medium
Jump Game II: medium
Largest Rectangle in Histogram: hard
Length of Last Word: easy
Letter Combinations of a Phone Number: easy
Longest Common Prefix: easy
***Longest Palindromic Substring: hard
Longest Substring Without Repeating Characters: easy
Longest Valid Parentheses: medium

Maximal Rectangle: hard
Maximum Subarray: dp
***Median of Two Sorted Arrays
Merge Intervals: easy
Merge k Sorted Lists: medium
Merge Sorted Array: medium
Merge Two Sorted Lists: easy
Minimum Path Sum: easy
Minimum Window Substring: hard
Multiply Strings: easy

N-Queens: easy
N-Queens II: dfs
Next Permutation: hard
Palindrome Number: Is there any better solution?
Partition List: medium linked list 
Permutation Sequence: medium number theory
Permutations: easy
***Permutations II: better solution than O(n! * lg(n!))?
Plus One: easy
Pow(x, n): medium how to write neat exponential steps

Regular Expression Matching: hard, boundry and logic. Better solution?
Remove Duplicates from Sorted Array: easy
Remove Duplicates from Sorted Array II: easy
Remove Duplicates from Sorted List: easy
Remove Duplicates from Sorted List II: medium
Remove Element: easy
Remove Nth Node From End of List: medium
Reverse Integer: easy
Reverse Linked List II: medium
Reverse Nodes in k-Group: medium

Roman to Integer: easy
Rotate Image: easy
Rotate List: easy
Scramble String: medium
Search a 2D Matrix: binary search, easy
Search for a Range: variant of binary search, easy
Search in Rotated Sorted Array: variant of binary search, medium
Search in Rotated Sorted Array II: variant of binary search, easy
Search Insert Position: variant of binary search, easy
Set Matrix Zeroes: easy

Simplify Path: meidum
Sort Colors: hard
Spiral Matrix: easy
Spiral Matrix II: easy
Sqrt(x): variant of binary search, medium
String to Integer (atoi): boring
Subsets: easy
***Subsets II: similar as problem Permutations II
Substring with Concatenation of All Words: hash, medium
Sudoku Solver: easy dfs

Swap Nodes in Pairs: linked list, easy
Text Justification: easy
***Trapping Rain Water: don't understand the problem
Two Sum: easy hash
Unique Paths: easy
Unique Paths II: easy
Valid Number: boring
Valid Parentheses: easy
Valid Sudoku: easy
Wildcard Matching: same as Regular Expression Matching

Word Search: easy dfs
ZigZag Conversion: easy

AFTER 10/24/2012 NEW ADDED
Interleaving String: easy dp
Convert Sorted List To Binary Search Tree: easy
Flatten Binary Tree to Linked List: medium