Python solutions to leetcode problems. Neither the fastest nor the cleverest solutions around. Solved problems # Problem Solution Difficulty 1 Two sum Solution Easy 2 Add two numbers Solution Medium 17 Letter combinations of a phone number Solution Medium 20 Valid parentheses Solution Easy 21 Merge two sorted lists Solution Easy 22 Generate parentheses Solution Medium 23 Merge K sorted lists Solution Hard 35 Search insert position Solution Easy 37 Sudoku solver Solution Hard 39 Combination sum Solution Medium 42 Trapping rain water Solution Hard 46 Permutations Solution Medium 53 Maximum subarray Solution Easy 62 Unique paths Solution Medium 63 Unique paths II Solution Medium 64 Minimum path sum Solution Medium 68 Text justification Solution Hard 70 Climbing stairs Solution Easy 79 Word search Solution Medium 93 Restore IP addresses Solution Medium 98 Validate binary search tree Solution Medium 100 Same tree Solution Easy 101 Symmetric tree Solution Easy 102 Binary tree level order traversal Solution Medium 103 Binary tree zigzag level order traversal Solution Medium 104 Maximum depth of binary tree Solution Easy 107 Binary tree level order traversal II Solution Easy 110 Balanced binary tree Solution Easy 111 Minimum depth of binary tree Solution Easy 112 Path sum Solution Easy 113 Path sum II Solution Medium 118 Pascal's triangle Solution Easy 127 Word ladder Solution Medium 129 Sum root to leaf numbers Solution Medium 144 Binary tree preorder traversal Solution Medium 169 Majority element Solution Easy 173 Binary search tree iterator Solution Medium 199 Binary tree right side view Solution Medium 200 Number of islands Solution Medium 203 Remove linked list elements Solution Easy 207 Course schedule Solution Medium 208 Implement trie (prefix tree) Solution Medium 217 Contains duplicate Solution Easy 226 Invert binary tree Solution Easy 230 Kth smallest element in a BST Solution Medium 234 Palindrome linked list Solution Easy 235 Lowest common ancestor of a binary search tree Solution Easy 236 Lowest common ancestor of a binary tree Solution Medium 242 Valid anagram Solution Easy 263 Ugly number Solution Easy 297 Serialize and deserialize binary tree Solution Hard 383 Ransom note Solution Easy 394 Decode string Solution Medium 404 Sum of left leaves Solution Easy 409 Longest palindrome Solution Easy 419 Battleships in a board Solution Medium 429 N-ary tree level order traversal Solution Easy 443 Minimum genetic mutation Solution Medium 451 Sort characters by frequency Solution Medium 461 Hamming distance Solution Easy 463 Island perimeter Solution Easy 478 Generate random point in a circle Solution Medium 508 Most frequent subtree sum Solution Medium 509 Fibonacci number Solution Easy 513 Find bottom left tree value Solution Medium 538 Convert BST to greater tree Solution Easy 547 Friend circles Solution Medium 559 Maximum depth of n-ary tree Solution Easy 567 Permutation in string Solution Medium 590 N-ary tree postorder traversal Solution Easy 617 Merge two binary trees Solution Easy 623 Add one row to tree Solution Medium 637 Average of levels in binary tree Solution Easy 654 Maximum binary tree Solution Medium 657 Robot return to origin Solution Easy 684 Redundant connection Solution Medium 695 Max area of island Solution Medium 700 Search in a binary search tree Solution Easy 704 Binary search Solution Easy 729 My calendar I Solution Medium 733 Flood fill Solution Easy 735 Asteroid collision Solution Medium 743 Network delay time Solution Medium 746 Min cost climbing stairs Solution Easy 771 Jewels and stones Solution Easy 778 Swim in rising water Solution Hard 784 Letter case permutation Solution Easy 797 All paths from source to target Solution Medium 802 Find eventual safe states Solution Medium 814 Binary tree pruning Solution Medium 844 Backspace string compare Solution Easy 846 Hand of straights Solution Medium 849 Maximize distance to closest person Solution Easy 856 Score of parentheses Solution Medium 863 All nodes distance K in binary tree Solution Medium 872 Leaf-similar trees Solution Easy 876 Middle of the linked list Solution Easy 884 Uncommon words from two sentences Solution Easy 917 Reverse only letters Solution Easy 921 Minimum add to make parentheses valid Solution Medium 931 Minimum falling path sum Solution Medium 934 Shortest bridge Solution Medium 935 Knight dialer Solution Medium 938 Range sum of BST Solution Easy 951 Flip equivalent binary trees Solution Medium 958 Check completeness of a binary tree Solution Medium 965 Univalued binary tree Solution Easy 973 K closest points to origin Solution Medium 980 Unique paths III Solution Hard 988 Smallest string starting from leaf Solution Medium 993 Cousins in binary tree Solution Easy 994 Rotting oranges Solution Medium 1020 Number of enclaves Solution Medium 1021 Remove outermost parentheses Solution Easy 1022 Sum of root to leaf binary numbers Solution Easy 1038 Binary search tree to greater sum tree Solution Medium 1046 Last stone weight Solution Easy 1047 Remove all adjacent duplicates in string Solution Easy 1110 Delete nodes and return forest Solution Medium 1129 Shortest path with alternating colors Solution Medium 1137 N-th Tribonacci number Solution Easy 1161 Maximum level sum of a binary tree Solution Medium 1184 Distance between bus stops Solution Easy 1189 Maximum number of balloons Solution Easy 1207 Unique number of occurrences Solution Easy 1219 Path with maximum gold Solution Medium 1220 Count vowels permutation Solution Hard 1254 Number of closed islands Solution Medium 1261 Find elements in a contaminated binary tree Solution Medium 1290 Convert binary number in a linked list to integer Solution Easy 1302 Deepest leaves sum Solution Medium 1305 All elements in two binary search trees Solution Medium 1306 Jump game III Solution Medium 1313 Decompress run-length encoded list Solution Easy 1315 Sum of nodes with even-valued grandparent Solution Medium 1325 Delete leaves with a given value Solution Medium 1342 Number of steps to reduce a number to zero Solution Easy 1365 How many numbers are smaller than the current number Solution Easy 1391 Check if there is a valid path in a grid Solution Medium 1436 Destination city Solution Easy 1417 Reformat the string Solution Easy 1422 Maximum score after splitting a string Solution Easy 1448 Count good nodes in binary tree Solution Medium 1456 Maximum number of vowels in a substring... Solution Medium 1470 Shuffle the array Solution Easy 1480 Running sum of 1d array Solution Easy 1496 Path crossing Solution Easy 1518 Water bottles Solution Easy 1528 Shuffle string Solution Easy 1557 Minimum number of vertices to reach all nodes Solution Medium 1559 Detect cycles in 2D grid Solution Hard 1592 Rearrange spaces between words Solution Easy 1598 Crawler log folder Solution Easy 1609 Even odd tree Solution Medium 1614 Maximum nesting depth of the parentheses Solution Easy 1615 Maximal network rank Solution Medium 1625 Lexicographically smallest string... Solution Medium 1807 Evaluate the bracket pairs of a string Solution Medium 1817 Finding the users active minutes Solution Medium 1823 Find the winner of the circular game Solution Medium