Solutions to the leetcode problems
-Already Summarized:
-
singleNumber.py
-
maxDepth.py
-
sameTree.py
-
maxProfitII.py (best time to buy and sell stock II)
-
uniqueBinarySearchTree.py
-
linkedListCycle.py
-
preorderTraversal.py (BST)
-
inorderTraversal.py (BST)
-
nextRightPointers.py (Tree)
-
searchInsertPosition.py
-
removeDuplicatesFromSortedList.py
-
reverseInteger.py
-
maximumSubarray.py
-
romanToInteger.py
-
climbStairs.py
-
integerToRoman.py
-
covertSortedArrayToBST.py
-
mergeTwoSortedLists.py
-
removeElement.py
-
swapNodesInPairs.py
-
balancedBinaryTree.py
-
sortColors.py (bucket sort)
-
grayCode.py (DP)
-
findMinInRotatedSortedArray.py
-
uniquePaths.py
-
removeDuplicatesFromSortedArray.py (twoPointers)
-
findPeakElement.py
-
generateParentheses.py
-
permute.py
-
maxProfit.py (Best Time to Buy and Sell Stock)
-
removeNthNodeFromEndOfList (Recursion && Two Pointers)
-
isValidBST
-
reverseWords.py
-
minStack.py
-
maxProduct.py
-
evaluateRpn.py
-
copyRandomList.py
-
strStr.py (twoPointers slow version and z alg are implemented - need to implement KMP algorithm)
-
containerWithMostWater.py (slower and faster version)
-
minimumPathSum.py
-
rotateImage.py
-
search2DMatrix.py
-
plusOne.py
-
symmetricTree.py
-
mergedSortedArray.py ( I have an easier version, but didn't get AC by leetcode)
-
spiralMatrix.py
-
sqrt.py
-
wordBreak.py (DFS version, need to implement DP version)
-
wordBreakII.py (DFS version, DP version)
-
numDistinct.py (distinct-subsequences)
-
nQueensII.py (have basic version and advanced version, need FANCY version)
-
singleNumberII.py (pay extra attention to the solution)
-
postorderTraversal.py (DFS version and Reverse version, need threaded tree)
-
stringToInt.py
-
isValidSudoku.py
-
solveSudoku.py
-
recoverBST.py
-
logestValidParentheses.py
-
isInterleave.py (The DFS version, need the DB version)
-
isScramble.py (Got the DFS version, which is a bit tricky, but not the DB version)
-
largestRectangleArea.py (I got the smart one, need a divide-conquer one)
-
maxProfitIII.py
-
isMatch.py (regular expression matching/DP version available, DFS version needed)
-
logestPalindrom.py (Greedy Algorithm one - n^3,DP n^2 and Manechester ones)
-
maximalRectangle.py (N^3 solution, need to optimize it)
-
reverseKGroup
-
pascalTri.py
-
pascalTriII.py
-
twoSum.py (dictionary is pretty weird, see pythonTrick for details)
-
threeSumClosest.py (read twice)
-
countAndSay.py
-
buildTreeInorderPostorder.py
-
buildTreeInorderPreorder.py
-
trap.py (two pointers version, need the stack version)
-
findMinInRotatedSortedArrayII.py
-
setZeroes.py
-
insertInterval.py
-
searchRange.py (I suspect the one i wrote is O(logn), the smart one is def O(logn) tho)
-
searchInRotatedSortedArrayII.py
-
jumpGameII.py
-
threeSum.py
-
removeDuplicatesFromSortedArrayII.py
-
fourSum.py
-
longestConsecutiveSequence.py
-
uniquePathsII.py
-
combinationSum2.py
-
triangle.py
-
nextPermutation.py (memorize it)
-
firstMissingPositive.py
-
mergeIntervals.py
-
wordSearch.py
-
combinationSum.py
-
wordLaddger.py
-
subsets.py
-
subsetsWithDup.py
-
jumpGame.py
-
searchInRotatedSortedArray.py
-
uniqueBinarySearchTreeII.py
-
spiralMatrixII.py
-
zigZagConversion.py (smart one in pythonTrick, normal one in array)
-
isValidParentheses.py
-
findMedianSortedArrays.py