Solve problems from LeetCode.
Switch branches/tags
Nothing to show
Clone or download
applewjg Repeated DNA Sequences
Change-Id: I83e981b7babe5d63049d633b9259e8bfa0ae427c
Latest commit 6109e6b Feb 7, 2015
Permalink
Failed to load latest commit information.
.gitattributes Make 'Leetcode' a new repository. Apr 6, 2013
.gitignore Make 'Leetcode' a new repository. Apr 6, 2013
3Sum.h update Dec 22, 2014
3SumClosest.h 3SumClosest.h Oct 13, 2014
4Sum.h Update solutions. Sep 26, 2013
AddBinary.h Update several problems. Sep 25, 2013
AddTwoNumbers.h dummy..I still have a long way to go! Sep 22, 2013
Anagrams.h Update several problems. Sep 25, 2013
BalancedBinaryTree.h Update Oct 7, 2014
BestTimetoBuyandSellStock.h Update Oct 6, 2014
BestTimetoBuyandSellStockII.h Update Oct 6, 2014
BestTimetoBuyandSellStockIII.h Minor refactor. Aug 21, 2013
BinarySearchTreeIterator.h add solution Dec 31, 2014
BinaryTreeInorderTraversal.h Add morris traversal. Aug 17, 2013
BinaryTreeLevelOrderTraversal.h Update solutions. Sep 30, 2013
BinaryTreeLevelOrderTraversalII.h Update solutions. Sep 30, 2013
BinaryTreeMaximumPathSum.h Update Oct 6, 2014
BinaryTreePostorderTraversal.h update Nov 20, 2014
BinaryTreePreorderTraversal.h Add binary tree preorder + reorder list. Nov 11, 2013
BinaryTreeZigzagLevelOrderTraversal.h Add a solution suggested by yinlinglin. Sep 12, 2013
Candy.h update Dec 12, 2014
ClimbingStairs.h Climbing Stairs. May 8, 2013
CloneGraph.h rename Clone\ Graph.h Oct 6, 2014
CombinationSum.h Update Subsets.. and Combination Sum... Sep 24, 2013
CombinationSumII.h Update Subsets.. and Combination Sum... Sep 24, 2013
Combinations.h Update solutions. Sep 30, 2013
CompareVersionNumbers.h Compare Version Numbers Dec 17, 2014
ConstructBinaryTreefromInorderandPostorderTraversal.h Update: Simplify parameters. May 16, 2013
ConstructBinaryTreefromPreorderandInorderTraversal.h Update: Simplify parameters. May 16, 2013
ContainerWithMostWater.h Refactor. Aug 22, 2013
ConvertSortedArraytoBinarySearchTree.h Convert Sorted Array to Binary Search Tree. Apr 9, 2013
ConvertSortedListtoBinarySearchTree.h update Dec 12, 2014
CopyListwithRandomPointer.h recursive solution Oct 5, 2014
CountandSay.h Update solutions. Sep 27, 2013
DecodeWays.h add solution Dec 3, 2014
DistinctSubsequences.h Update Oct 7, 2014
DivideTwoIntegers.h update Dec 22, 2014
DungeonGame.h fix buf Jan 11, 2015
EditDistance.h Update solutions. Sep 30, 2013
EvaluateReversePolishNotation.h Update EvaluateReversePolishNotation.h Jan 8, 2014
ExcelSheetColumnNumber.h Excel Sheet Column Number Dec 28, 2014
ExcelSheetColumnTitle.h Excel Sheet Column Title Dec 20, 2014
FactorialTrailingZeroes.cpp FactorialTrailingZeroes Dec 30, 2014
FindMinimumInRotatedSortedArray.h chmod 664 MinStack.h FindMiniumInRotatedSortedArray* Nov 27, 2014
FindMinimumInRotatedSortedArrayII.h chmod 664 MinStack.h FindMiniumInRotatedSortedArray* Nov 27, 2014
FindPeakElement.h update Dec 21, 2014
FirstMissingPositive.h First Missing Positive. Apr 21, 2013
FlattenBinaryTreetoLinkedList.h Update Oct 6, 2014
FractionToRecurringDecimal.h FractionToRecurringDecimal Dec 21, 2014
GasStation.h Add solutions to new problems and Update LPS. Oct 3, 2013
GenerateParentheses.h update Dec 22, 2014
GrayCode.h Gray Code. May 16, 2013
ImplementstrStr().h update strStr() Dec 18, 2014
InsertInterval.h update Dec 14, 2014
InsertionSortList.h Add Insertion Sort List. Mar 5, 2014
IntegertoRoman.h update Dec 22, 2014
InterleavingString.h Fix a bug #14 reported by imley. Mar 28, 2014
IntersectionOfTwoLinkedLists.h IntersectionOfTwoLinkedLists.h Nov 28, 2014
JumpGame.h Minor refactor. Aug 22, 2013
JumpGameII.h update Dec 27, 2014
LRUCache.h no need to update the iterator in cachemap[key] Oct 5, 2014
LargestNumber.h Largest Number Jan 12, 2015
LargestRectangleinHistogram.h Update Oct 9, 2014
LengthofLastWord.h Minor refactor. Aug 10, 2013
LetterCombinationsofaPhoneNumber.h update Dec 3, 2014
LinkedListCycle.h ~ Oct 5, 2014
LinkedListCycleII.h ~ Oct 5, 2014
LongestCommonPrefix.h update Dec 22, 2014
LongestConsecutiveSequence.h Edit. Jun 19, 2014
LongestPalindromicSubstring.h LongestPalindromicSubstring.h fix a small bug Nov 17, 2014
LongestSubstringWithoutRepeatingCharacters.h new solution Dec 13, 2014
LongestValidParentheses.h add solution Jan 15, 2015
MajorityElement.h update Dec 22, 2014
MaxPointsOnALine.h update Dec 3, 2014
MaximalRectangle.h fix bug Oct 9, 2014
MaximumDepthofBinaryTree.h Refactor. Leaf node can also use last sentence. Apr 9, 2013
MaximumGap.h update comment Dec 14, 2014
MaximumProductSubarray.h MaximumProductSubarray.h Oct 6, 2014
MaximumSubarray.h Maximum Subarray (dp). Apr 21, 2013
MedianofTwoSortedArrays.h Minor refactor. Aug 19, 2013
MergeIntervals.h Update several problems. Sep 25, 2013
MergeSortedArray.h Delete unnecessary while loop. Aug 6, 2013
MergeTwoSortedLists.h Use dummy head. Sep 2, 2013
MergekSortedLists.h another solution for mergeKSortedLists Nov 17, 2014
MinStack.h chmod 664 MinStack.h FindMiniumInRotatedSortedArray* Nov 27, 2014
MinimumDepthofBinaryTree.h update Nov 17, 2014
MinimumPathSum.h One-dimensional DP instead of two. Jul 30, 2013
MinimumWindowSubstring.h Update solutions. Sep 30, 2013
MultiplyStrings.h Update solution. Aug 20, 2013
N-Queens.h Use bit-manipulation solution. Jul 25, 2013
N-QueensII.h Add iterative solution. Aug 22, 2013
NextPermutation.h update Dec 20, 2014
PalindromeNumber.h Add recursive solution. Aug 21, 2013
PalindromePartitioning.h Update Oct 6, 2014
PalindromePartitioningII.h Update Oct 6, 2014
PartitionList.h Update Oct 7, 2014
Pascal'sTriangle.h Update Oct 6, 2014
Pascal'sTriangleII.h Update solutions. Sep 27, 2013
PathSum.h Refactor. Jul 26, 2013
PathSum2.h Update Oct 6, 2014
PermutationSequence.h Much more easier to understand. Aug 11, 2013
Permutations.h Remove two unnecessary parameters of permuteRe. Jul 19, 2013
PermutationsII.h Change the way handling duplicates. Sep 1, 2013
PlusOne.h update Nov 18, 2014
PopulatingNextRightPointersinEachNode.h Update Oct 6, 2014
PopulatingNextRightPointersinEachNodeII.h Update Oct 6, 2014
Pow(x,n).h Update several problems. Sep 25, 2013
README.md Fix broken difficulty distribution chart link Oct 10, 2014
RecoverBinarySearchTree.h Recover Binary Search Tree (high difficulty). Jun 15, 2013
RegularExpressionMatching.h update Dec 21, 2014
RemoveDuplicatesfromSortedArray.h Update solutions. Sep 27, 2013
RemoveDuplicatesfromSortedArrayII.h update Dec 12, 2014
RemoveDuplicatesfromSortedList.h Update solutions. Sep 27, 2013
RemoveDuplicatesfromSortedListII.h update Dec 12, 2014
RemoveElement.h Update several problems. Sep 25, 2013
RemoveNthNodeFromEndofList.h update Dec 12, 2014
ReorderList.h Add binary tree preorder + reorder list. Nov 11, 2013
RepeatedDNASequences.h Repeated DNA Sequences Feb 7, 2015
RestoreIPAddresses.h Update solutions. Sep 30, 2013
ReverseInteger.h update Dec 15, 2014
ReverseLinkedListII.h Update solutions. Sep 27, 2013
ReverseNodesinkGroup.h Update solutions. Sep 27, 2013
ReverseWordsInAString.h new solution for in place Dec 13, 2014
RomantoInteger.h Refactor. Sep 22, 2013
RotateImage.h Add solution 2. Jul 21, 2013
RotateList.h Rotate List. Apr 8, 2013
SameTree.h Same Tree. Apr 7, 2013
ScrambleString.h Add a dp solution. Sep 13, 2013
SearchInsertPosition.h Search Insert Position. Apr 18, 2013
Searcha2DMatrix.h Update solutions. Sep 27, 2013
SearchforaRange.h Refactor. Jul 30, 2013
SearchinRotatedSortedArray.h Keep binary-search solution only. Aug 7, 2013
SearchinRotatedSortedArrayII.h update Nov 18, 2014
SetMatrixZeroes.h Refactor. Jul 23, 2013
SimplifyPath.h Update solutions. Sep 30, 2013
SingleNumber.h assert the number of the given array Oct 4, 2014
SingleNumberII.h update Nov 17, 2014
SortColors.h Update solutions. Sep 27, 2013
SortList.h Sort List. Jan 8, 2014
SpiralMatrix.h Update solutions. Sep 30, 2013
SpiralMatrixII.h Update solutions. Sep 30, 2013
Sqrt(x).h Add blog info. Apr 19, 2013
StringtoInteger(atoi).h add solution Dec 15, 2014
Subsets.h update Nov 18, 2014
SubsetsII.h update Nov 18, 2014
SubstringwithConcatenationofAllWords.h SubstringwithConcatenationofAllWords -> add solution Jan 15, 2015
SudokuSolver.h Update solutions. Sep 30, 2013
SumRoottoLeafNumbers.h Add iterative solution. Jul 21, 2013
SurroundedRegions.h Call bfs by default. Apr 27, 2014
SwapNodesinPairs.h Refactor. Sep 22, 2013
SymmetricTree.h Update Oct 7, 2014
TextJustification.h Update solutions. Sep 27, 2013
TrappingRainWater.h update Dec 23, 2014
Triangle.h Add another solution. May 14, 2013
TwoSum.h Update TwoSum.h Nov 4, 2014
TwoSumIII.h Two Sum III Dec 26, 2014
UniqueBinarySearchTrees.h Update Oct 7, 2014
UniqueBinarySearchTreesII.h Unique Binary Search Trees II. Jul 11, 2013
UniquePaths.h Update Oct 9, 2014
UniquePathsII.h Update Oct 9, 2014
ValidNumber.h add valid number solution Feb 7, 2015
ValidPalindrome.h Delete unnecessary check. Jul 19, 2013
ValidParentheses.h Refactor (update the logic). Jul 14, 2013
ValidSudoku.h Minor refactor. Sep 3, 2013
ValidateBinarySearchTree.h update Dec 26, 2014
WildcardMatching.h update Dec 27, 2014
WordBreak.h Add a new problem: word break. Oct 6, 2013
WordBreakII.h Add word break 2. Oct 7, 2013
WordLadder.h Word Ladder. Jun 8, 2013
WordLadderII.h Word Ladder II. Jul 8, 2013
WordSearch.h Update solutions. Sep 30, 2013
ZigZagConversion.h update Dec 14, 2014

README.md

LeetCode

Solve problems from Leetcode. All the codes are tested using online-judge.

Here is a difficulty and frequency distribution chart for each problem, which I got from the Internet and is very useful. Feel free to make pull request for adding the difficulty and frequency for new problems here.

Please feel free to let me know if you have any problem or better solutions:)

Note: The problem link in the file will take you to the Old OJ, which will expire on October 12, 12pm PST.
You may use this link to the new OJ instead!