Need help with leetcode?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

123 Stars 70 Forks GNU General Public License v3.0 636 Commits 0 Opened issues


Solutions to Leetcode Online Judge

Services available


Need anything else?

Contributors list

# 345,322
437 commits

Leetcode solutions in C++, Java, Python

|#|Title|Difficulty| |---|-----|----------| |373|Find K Pairs with Smallest Sums|Medium| |372|Super Pow|Medium| |371|Sum of Two Integers|Easy| |370|Range Addition|Medium| |369|Plus One Linked List|Medium| |368|Largest divisible subset|Medium| |367|Valid Perfect Square|Medium| |366|Find Leaves of Binary Tree|Medium| |365|Water and Jug Problem|Medium| |364|Nested List Weight Sum II|Medium| |363|Max Sum of Rectangle No Larger Than K|Hard| |362|Design Hit Counter|Medium| |361|Bomb Enemy|Medium| |360|Sort Transformed Array|Medium| |359|Logger Rate Limiter|Easy| |358|Rearrage String K distance Apart|Hard| |357|Count Numbers with Unique Digits|Medium| |356|Line Reflection|Medium| |355|Design Twitter|Medium| |354|Russian Doll Envelopes|Hard| |353|Design Snake Game|Medium| |352|Data Stream as Disjoint Intervals|Hard| |351|Android unlock patterns|Medium| |350|Intersection of Two Arrays II|Easy| |349|Intersection of Two Arrays|Easy| |348|Design tic-tac-toe|Medium| |347|Top K frequent elements|Medium| |346|Moving Average from data stream|Easy| |345|Reverse Vowels of a String|Easy| |344|Reverse String|Easy| |343|Integer Break|Medium| |342|Power of Four|Easy| |341|Flatten Nested List Iterator|Medium| |340|Longest Substring with At Most K Distinct Characters|Hard| |339|Nested List Weight Sum|Easy| |338|Counting Bits|Medium| |337|House Robber III|Medium| |336|Palindrome Pairs|Hard| |335|Self Crossing|Hard| |334|Increasing Triplet Subsequence|Medium| |333|Largest BST subtree|Medium| |332|Reconstruct Itinerary|Medium| |331|Verify Preorder Serialization of a Binary Tree|Medium| |330|Patching Array|Medium| |329|Longest Increasing Path in a Matrix|Hard| |328|Odd Even Linked List|Easy| |327|Count of Range Sum|Hard| |326|Power of Three|Easy| |325|Maximum Size Subarray Sum Equals k|Easy| |324|Wiggle Sort II|Medium| |323|Number of Connected Components|Medium| |322|Coin Change|Medium| |321|Create Maximum Number|Hard| |320|Generalized Abbreviation|Medium| |319|Bulb Switcher|Medium| |318|Maximum Product of Word Lengths|Medium| |317|Shortest Distance from All Buildings|Hard| |316|Remove Duplicate Letters|Medium| |315|Count of Smaller Numbers After Self|Hard| |314|Binary Tree Vertical Order Traversal|Medium| |313|Super Ugly Number|Medium| |312|Burst Balloons|Medium| |311|Sparse Matrix Multiplication|Medium| |310|Minimum Height Trees|Medium| |309|Best Time to Buy and Sell Stock with Cooldown|Medium| |308|Range Sum Query 2D - Mutable|Hard| |307|Range Sum Query - Mutable|Medium| |306|Additive Number|Medium| |305|Number of Islands II|Hard| |304|Range Sum Query 2D - Immutable|Medium| |303|Range Sum Query - Immutable|Easy| |302|Smallest Rectangle Enclosing Black Pixels|Hard| |301|Remove Invalid Parentheses|Hard| |300|Longest Increasing Subsequence|Medium| |299|Bulls and Cows|Easy| |298|Binary Tree Longest Consecutive Sequence|Medium| |297|Serialize and Deserialize Binary Tree|Medium| |296|Best Meeting Point|Hard| |295|Find Median from Data Stream|Hard| |294|Flip Game II|Medium| |293|Flip Game|Easy| |292|Nim Game|Easy| |291|Word Pattern II|Hard| |290|Word Pattern|Easy| |289|Game of Life|Medium| |288|Unique Word Abbreviation|Easy| |287|Find the Duplicate Number|Hard| |286|Walls and Gates|Medium| |285|Inorder Successor in BST|Medium| |284|Peeking Iterator|Medium| |283|Moving Zeroes|Easy| |282|Expression Add Operators|Hard| |281|Zigzag Iterator|Medium| |280|Wiggle Sort|Medium| |279|Perfect Squares|Medium| |278|First Bad Version|Easy| |277|Find the Celebrity|Medium| |276|Paint Fence|Easy| |275|H Index II|Medium| |274|H Index|Medium| |273|Integer to English Words|Medium| |272|Closest Binary Search Tree Value II|Hard| |271|Encode and Decode Strings|Medium| |270|Closest Binary Search Tree Value|Easy| |269|Alien Dictionary|Hard| |268|Missing Number|Medium| |267|Palindrome Permutation II|Medium| |266|Palindrome Permutation|Easy| |265|Paint House II|Hard| |264|Ugly Number II|Medium| |263|Ugly Number|Easy| |261|Graph Valid Tree|Medium| |260|Single Number III|Medium| |259|3Sum Smaller|Medium| |258|Add Digits|Easy| |257|Binary Tree Paths|Easy| |256|Paint House|Medium| |255|Verify Preorder Sequence in Binary Search Tree|Medium| |254|Factor Combinations|Medium| |253|Meeting Rooms II|Medium| |252|Meeting Rooms|Easy| |251|Flatten 2D Vector|Medium| |250|Count Univalue Subtrees|Medium| |249|Group Shifted Strings|Easy| |248|Strobogrammatic Number III|Hard| |247|Strobogrammatic Number II|Medium| |246|Strobogrammatic Number|Easy| |245|Shortest Word Distance III|Medium| |244|Shortest Word Distance II|Medium| |243|Shortest Word Distance|Easy| |242|Valid Anagram|Easy| |241|Different Ways to Add Parentheses|Medium| |240|Search a 2D Matrix II|Medium| |239|Sliding Window Maximum|Hard| |238|Product of Array Except Self|Medium| |237|Delete Node in a Linked List|Easy| |236|Lowest Common Ancestor of a Binary Tree|Medium| |235|Lowest Common Ancestor of a Binary Search Tree|Easy| |234|Palindrome Linked List|Easy| |233|Number of Digit One|Medium| |232|Implement Queue using Stacks|Easy| |231|Power of Two|Easy| |230|Kth Smallest Element in a BST|Medium| |229|Majority Element II|Medium| |228|Summary Ranges|Easy| |227|Basic Calculator II|Medium| |226|Invert Binary Tree|Easy| |225|Implement Stack using Queues|Medium| |224|Basic Calculator|Medium| |223|Rectangle Area|Easy| |222|Count Complete Tree Nodes|Medium| |221|Maximal Square|Medium| |220|Contains duplicate iii|Medium| |219|Contains duplicate ii|Easy| |218|The Skyline Problem |Hard| |217|Contains duplicate|Easy| |216|Combination Sum III|Medium| |215|Kth Largest Element in an Array |Medium| |214|Shortest Palindrome|Hard| |213|House robber II|Medium| |212|Word search II|Hard| |211|Add and Search Word|Medium| |210|Course schedule II|Medium| |209|Minimum Size Subarray Sum |Medium| |208|Implement Trie|Medium| |207|Course schedule|Medium| |205|Revese linkedlist|Easy| |205|Isomorphic Strings|Easy| |204|Count primes|Medium| |203|Remove Linked List Elements|Easy| |202|Happy Number|Easy| |201|Bitwise AND of Numbers Range|Medium| |200|Number of islands|Medium| |199|Binary tree right side view|Medium| |198|House robber|Easy| |191|Number of 1 bits|Easy| |190|Reverse bits|Easy| |189|Rotate array|Easy| |188|Best Time to Buy and Sell Stock IV|Hard| |187|Repeated DNA Sequences|Medium| |176|Reverse Words in a String II|Medium| |179|Largest Number|Medium| |174|Dungeon Game|Hard| |173|Binary Search Tree Iterator|Medium| |172|Factorial Trailing Zeroes|Easy| |171|Excel Sheet Column Number|Easy| |169|Majority Element|Easy| |168|Excel Sheet Column Title|Easy| |166|Fraction to Recurring Decimal|Medium| |165|Compare Version Numbers|Easy| |164|Maximum Gap|Hard| |163|Missing Ranges|Medium| |162|Find Peak Element|Medium| |161|One Edit Distance|Medium| |160|Intersection of Two Linked Lists|Easy| |159|Longest Substring with At Most Two Distinct Characters|Hard| |158|Read N Characters Given Read4 II - Call multiple times|Hard| |157|Read N Characters Given Read4|Easy| |156|Binary Tree Upside Down|Medium| |155|Min Stack|Easy| |154|Find Minimum in Rotated Sorted Array II|Hard| |153|Find Minimum in Rotated Sorted Array|Medium| |152|Maximum Product Subarray|Medium| |151|Reverse Words in a String|Medium| |150|Evaluate Reverse Polish Notation|Medium| |149|Max Points on a Line|Hard| |148|Sort List|Medium| |147|Insertion Sort List|Medium| |146|LRU Cache|Hard| |145|Binary Tree Postorder Traversal|Hard| |144|Binary Tree Preorder Traversal|Medium| |143|Reorder List|Medium| |142|Linked List Cycle II|Medium| |141|Linked List Cycle|Medium| |140|Word Break II|Hard| |139|Word Break|Medium| |138|Copy List with Random Pointer|Hard| |137|Single Number II|Medium| |136|Single Number|Medium| |135|Candy|Hard| |134|Gas Station|Medium| |133|Clone Graph|Medium| |132|Palindrome Partitioning II|Hard| |131|Palindrome Partitioning|Medium| |130|Surrounded Regions|Medium| |129|Sum Root to Leaf Numbers|Medium| |128|Longest Consecutive Sequence|Hard| |127|Word Ladder II|Hard| |126|Word Ladder|Medium| |125|Valid Palindrome|Easy| |124|Binary Tree Maximum Path Sum|Hard| |123|Best Time to Buy and Sell Stock III|Hard| |122|Best Time to Buy and Sell Stock II|Medium| |121|Best Time to Buy and Sell Stock|Medium| |120|Triangle|Medium| |119|Pascal's Triangle II|Easy| |118|Pascal's Triangle|Easy| |117|Populating Next Right Pointers in Each Node II|Hard| |116|Populating Next Right Pointers in Each Node|Medium| |115|Distinct Subsequences|Hard| |114|Flatten Binary Tree to Linked List|Medium| |113|Path Sum II|Medium| |112|Path Sum|Easy| |111|Minimum Depth of Binary Tree|Easy| |110|Balanced Binary Tree|Easy| |109|Convert Sorted List to Binary Search Tree|Medium| |108|Convert Sorted Array to Binary Search Tree|Medium| |107|Binary Tree Level Order Traversal II|Easy| |106|Construct Binary Tree from Inorder and Postorder|Medium| |105|Construct Binary Tree from Preorder and Inorder|Medium| |104|Maximum Depth of Binary Tree|Easy| |103|Binary Tree Zigzag Level Order Traversal|Medium| |102|Binary Tree Level Order Traversal|Easy| |101|Symmetric Tree|Easy| |100|Same Tree|Easy| |99|Recover Binary Search Tree|Hard| |98|Validate Binary Search Tree|Medium| |97|Interleaving String|Hard| |96|Unique Binary Search Trees II|Medium| |95|Unique Binary Search Trees|Medium| |94|Binary Tree Inorder Traversal|Medium| |93|Restore IP Addresses|Medium| |92|Reverse linked List II|Medium| |91|Subsets II|Medium| |90|Decode Ways|Medium| |89|Gray Code|Medium| |88|Merge Sorted Array|Easy| |87|Scramble String|Hard| |86|Partition List|Medium| |85|Maximal Rectangle|Hard| |84|Largest Rectangle in Histogram|Hard| |83|Remove Duplicates from Sorted List II|Medium| |82|Remove Duplicates from Sorted List|Easy| |81|Search in Rotated Sorted Array II|Medium| |80|Remove Duplicates from Sorted Array II|Medium| |79|Word Search|Medium| |78|Subsets|Medium| |77|Combinations|Medium| |76|Minimum Window Substring|Hard| |75|Sort Colors|Medium| |74|Search a 2D Matrix|Medium| |73|Set Matrix Zeroes|Medium| |72|Edit Distance|Hard| |71|Simplify Path|Medium| |70|Climbing Stairs|Easy| |69|Sqrt(x)|Medium| |68|Text Justification|Hard| |67|Plus One|Easy| |66|Valid Number|Easy| |65|Add Binary|Easy| |64|Merge Two Sorted Lists|Easy| |63|Minimum Path Sum|Medium| |62|Unique Paths II|Medium| |61|Unique Paths|Medium| |60|Rotate List|Medium| |59|Permutation Sequence|Medium| |58|Spiral Matrix II|Medium| |57|Length of Last Word|Easy| |56|Insert Interval|Hard| |55|Merge Intervals|Hard| |54|Jump Game|Medium| |53|Spiral Matrix|Medium| |52|Maximum Subarray|Medium| |51|N-Queens II|Hard| |50|N-Queens|Hard| |49|"Pow(x, n)"|Medium| |48|Anagrams|Medium| |47|Rotate Image|Medium| |46|Permutations II|Hard| |45|Permutations|Medium| |44|Jump Game II|Hard| |43|Wildcard Matching|Hard| |41|Trapping Rain Water|Hard| |40|First Missing Positive|Hard| |39|Combination Sum II|Medium| |38|Combination Sum|Medium| |37|Count and Say|Easy| |36|Sudoku Solver|Hard| |35|Valid Sudoku|Easy| |34|Search Insert Position|Medium| |33|Search for a Range|Medium| |31|Longest Valid Parentheses|Hard| |32|Search in Rotated Sorted Array|Hard| |30|Next Permutation|Medium| |29|Substring with Concatenation of All Words|Hard| |28|Divide Two Integers|Medium| |27|Implement strStr()|Easy| |26|Remove Element|Easy| |25|Remove Duplicates from Sorted Array|Easy| |24|Reverse Nodes in k-Group|Hard| |23|Swap Nodes in Pairs|Medium| |22|Merge k Sorted Lists|Hard| |21|Generate Parentheses|Medium| |20|Valid Parentheses|Easy| |19|Remove Nth Node From End of List|Easy| |18|Letter Combinations of a Phone Number|Medium| |17|4Sum|Medium| |16|3Sum Closest|Medium| |15|3Sum|Medium| |14|Longest Common Prefix|Easy| |13|Roman to Integer|Easy| |12|Integer to Roman|Medium| |11|Container With Most Water|Medium| |10|Regular Expression Matching|Hard| |9|Palindrome Number|Easy| |8|String to Integer (atoi)|Easy| |7|Reverse Integer|Easy| |6|ZigZag Conversion|Easy| |5|Longest Palindromic Substring|Medium| |4|Median of Two Sorted Arrays|Hard| |3|Longest Substring Without Repeating Characters|Medium| |2|Add Two Numbers|Medium| |1|Two Sum|Medium|

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.