pezy
LeetCode
C++

:pencil2: LeetCode solutions in C++ 11 and Python3

Last updated Jul 3, 2026
3.5k
Stars
962
Forks
6
Issues
0
Stars/day
Attention Score
56
Language breakdown
C++ 97.1%
Python 2.9%
โ–ธ Files click to expand
README

LeetCode ======== LeetCode solutions in C++ 11 and Python3. |NO.|Title|Solution|Note|Difficulty|Tag| |---|-----|--------|----|----------|---| |0|Two Sum|C++ Python|Note|Easy|Mapping| |1|Add Two Numbers|C++ Python|Note|Medium|LinkedList| |2|Longest Substring Without Repeating Characters|C++ Python|Note|Medium|Mapping| |3|Median of Two Sorted Arrays|C++ Python|Note|Hard| |4|Longest Palindromic Substring|C++ Python|Note|Medium| |5|ZigZag Conversion|C++ Python|Note|Medium| |6|Reverse Integer|C++ Python|Note|Easy| |7|String to Integer (atoi)|C++/solution.h) Python/solution.py)|Note)|Medium| |8|Palindrome Number|C++ Python|Note|Easy| |9|Regular Expression Matching|C++ Python|Note|Hard| |10|Container With Most Water|C++ Python|Note|Medium| |11|Integer to Roman|C++ Python|Note|Medium| |12|Roman to Integer|C++ Python|Note|Easy| |13|Longest Common Prefix|C++ Python|Note|Easy| |14|3Sum|C++ Python|Note|Medium| |15|3Sum Closest|C++ Python|Note|Medium| |16|Letter Combinations of a Phone Number|C++ Python|Note|Medium| |17|4Sum|C++ Python|Note|Medium| |18|Remove Nth Node From End of List|C++ Python|Note|Medium| |19|Valid Parentheses|C++ Python|Note|Easy| |20|Merge Two Sorted Lists|C++ Python|Note|Easy| |21|Generate Parentheses|C++ Python|Note|Medium| |22|Merge k Sorted Lists|C++ Python|Note|Hard| |23|Swap Nodes in Pairs|C++ Python|Note|Medium| |24|Reverse Nodes in k-Group|C++ Python|Note|Hard| |25|Remove Duplicates from Sorted Array|C++ Python|Note|Easy| |26|Remove Element|C++ Python|Note|Easy| |27|Implement strStr()|C++/solution.h) Python/solution.py)|Note)|Easy| |28|Divide Two Integers|C++ Python|Note|Medium| |29|Substring with Concatenation of All Words|C++ Python|Note|Hard| |30|Next Permutation|C++ Python|Note|Medium| |31|Longest Valid Parentheses|C++ Python|Note|Hard| |32|Search in Rotated Sorted Array|C++ Python|Note|Medium| |33|Search for a Range|C++ Python|Note|Medium| |34|Search Insert Position|C++ Python|Note|Easy| |35|Valid Sudoku|C++ Python|Note|Medium| |36|Sudoku Solver|C++ Python|Note|Hard| |37|Count and Say|C++ Python|Note|Easy| |38|Combination Sum|C++ Python|Note|Medium| |39|Combination Sum II|C++ Python|Note|Medium| |40|First Missing Positive|C++ Python|Note|Hard| |41|Trapping Rain Water|C++ Python|Note|Hard| |42|Multiply Strings|C++ Python|Note|Medium| |43|Wildcard Matching|C++ Python|Note|Hard| |44|Jump Game II|C++ Python|Note|Hard| |45|Permutations|C++ Python|Note|Medium| |46|Permutations II|C++ Python|Note|Medium| |47|Rotate Image|C++ Python|Note|Medium| |48|Group Anagrams|C++ Python|Note|Medium| |49|Pow(x, n)|C++/solution.h) Python/solution.py)|Note)|Medium| |50|N-Queens|C++ Python|Note|Hard| |51|N-Queens II|C++ Python|Note|Hard| |52|Maximum Subarray|C++ Python|Note|Easy| |53|Spiral Matrix|C++ Python|Note|Medium| |54|Jump Game|C++ Python|Note|Medium| |55|Merge Intervals|C++ Python|Note|Medium| |56|Insert Interval|C++ Python|Note|Hard| |57|Length of Last Word|C++ Python|Note|Easy| |58|Spiral Matrix II|C++ Python|Note|Medium| |59|Permutation Sequence|C++ Python|Note|Medium| |60|Rotate List|C++ Python|Note|Medium| |61|Unique Paths|C++ Python|Note|Medium| |62|Unique Paths II|C++ Python|Note|Medium| |63|Minimum Path Sum|C++ Python|Note|Medium| |64|Valid Number|C++ Python|Note|Hard| |65|Plus One|C++ Python|Note|Easy| |66|Add Binary|C++ Python|Note|Easy| |67|Text Justification|C++ Python|Note|Hard| |68|Sqrt(x)|C++/solution.h) Python/solution.py)|Note)|Easy| |69|Climbing Stairs|C++ Python|Note|Easy| |70|Simplify Path|C++ Python|Note|Medium| |71|Edit Distance|C++ Python|Note|Hard| |72|Set Matrix Zeroes|C++ Python|Note|Medium| |73|Search a 2D Matrix|C++ Python|Note|Medium| |74|Sort Colors|C++ Python|Note|Medium| |75|Minimum Window Substring|C++ Python|Note|Hard| |76|Combinations|C++ Python|Note|Medium| |77|Subsets|C++ Python|Note|Medium| |78|Word Search|C++ Python|Note|Medium| |79|Remove Duplicates from Sorted Array II|C++ Python|Note|Medium| |80|Search in Rotated Sorted Array II|C++ Python|Note|Medium| |81|Remove Duplicates from Sorted List II|C++ Python|Note|Medium| |82|Remove Duplicates from Sorted List|C++ Python|Note|Easy| |83|Largest Rectangle in Histogram|C++ Python|Note|Hard| |84|Maximal Rectangle|C++ Python|Note|Hard| |85|Partition List|C++ Python|Note|Medium| |86|Scramble String|C++ Python|Note|Hard| |87|Merge Sorted Array|C++ Python|Note|Easy| |88|Gray Code|C++ Python|Note|Medium| |89|Subsets II|C++ Python|Note|Medium| |90|Decode Ways|C++ Python|Note|Medium| |91|Reverse Linked List II|C++ Python|Note|Medium| |92|Restore IP Addresses|C++ Python|Note|Medium| |93|Binary Tree Inorder Traversal|C++ Python|Note|Medium| |94|Unique Binary Search Trees II|C++ Python|Note|Medium| |95|Unique Binary Search Trees|C++ Python|Note|Medium| |96|Interleaving String|C++ Python|Note|Hard| |97|Validate Binary Search Tree|C++ Python|Note|Medium| |98|Recover Binary Search Tree|C++ Python|Note|Hard| |99|Same Tree|C++ Python|Note|Easy| |100|Symmetric Tree|C++ Python|Note|Easy| |101|Binary Tree Level Order Traversal|C++ Python|Note|Medium| |102|Binary Tree Zigzag Level Order Traversal|C++ Python|Note|Medium| |103|Maximum Depth of Binary Tree|C++ Python|Note|Easy| |104|Construct Binary Tree from Preorder and Inorder Traversal|C++ Python|Note|Medium| |105|Construct Binary Tree from Inorder and Postorder Traversal|C++ Python|Note|Medium| |106|Binary Tree Level Order Traversal II|C++ Python|Note|Easy| |107|Convert Sorted Array to Binary Search Tree|C++ Python|Note|Easy| |108|Convert Sorted List to Binary Search Tree|C++ Python|Note|Medium| |109|Balanced Binary Tree|C++ Python|Note|Easy| |110|Minimum Depth of Binary Tree|C++ Python|Note|Easy| |111|Path Sum|C++ Python|Note|Easy| |112|Path Sum II|C++ Python|Note|Medium| |113|Flatten Binary Tree to Linked List|C++ Python|Note|Medium| |114|Distinct Subsequences|C++ Python|Note|Hard| |115|Populating Next Right Pointers in Each Node|C++ Python|Note|Medium| |116|Populating Next Right Pointers in Each Node II|C++ Python|Note|Medium| |117|Pascal's Triangle|C++ Python|Note|Easy| |118|Pascal's Triangle II|C++ Python|Note|Easy| |119|Triangle|C++ Python|Note|Medium| |120|Best Time to Buy and Sell Stock|C++ Python|Note|Easy| |121|Best Time to Buy and Sell Stock II|C++ Python|Note|Easy| |122|Best Time to Buy and Sell Stock III|C++ Python|Note|Hard| |123|Binary Tree Maximum Path Sum|C++ Python|Note|Hard| |124|Valid Palindrome|C++ Python|Note|Easy| |125|Word Ladder II|C++ Python|Note|Hard| |126|Word Ladder|C++ Python|Note|Medium| |127|Longest Consecutive Sequence|C++ Python|Note|Hard| |128|Sum Root to Leaf Numbers|C++ Python|Note|Medium| |129|Surrounded Regions|C++ Python|Note|Medium| |130|Palindrome Partitioning|C++ Python|Note|Medium| |131|Palindrome Partitioning II|C++ Python|Note|Hard| |132|Clone Graph|C++ Python|Note|Medium| |133|Gas Station|C++ Python|Note|Medium| |134|Candy|C++ Python|Note|Hard| |135|Single Number|C++ Python|Note|Easy| |136|Single Number II|C++ Python|Note|Medium| |137|Copy List with Random Pointer|C++ Python|Note|Medium| |138|Word Break|C++ Python|Note|Medium| |139|Word Break II|C++ Python|Note|Hard| |140|Linked List Cycle|C++ Python|Note|Easy| |141|Linked List Cycle II|C++ Python|Note|Medium| |142|Reorder List|C++ Python|Note|Medium| |143|Binary Tree Preorder Traversal|C++ Python|Note|Medium| |144|Binary Tree Postorder Traversal|C++ Python|Note|Hard| |145|LRU Cache|C++ Python|Note|Hard| |146|Insertion Sort List|C++ Python|Note|Medium| |147|Sort List|C++ Python|Note|Medium| |148|Max Points on a Line|C++ Python|Note|Hard| |149|Evaluate Reverse Polish Notation|C++ Python|Note|Medium| |150|Reverse Words in a String|C++ Python|Note|Medium| |151|Maximum Product Subarray|C++ Python|Note|Medium| |152|Find Minimum in Rotated Sorted Array|C++ Python|Note|Medium| |153|Find Minimum in Rotated Sorted Array II|C++ Python|Note|Hard| |154|Min Stack|C++ Python|Note|Easy| |155|Binary Tree Upside Down|C++ Python|Note|None| |156|Read N Characters Given Read4|C++ Python|Note|None| |157|Read N Characters Given Read4 II - Call multiple times|C++ Python|Note|None| |158|Longest Substring with At Most Two Distinct Characters|C++ Python|Note|None| |159|Intersection of Two Linked Lists|C++ Python|Note|Easy| |160|One Edit Distance|C++ Python|Note|None| |161|Find Peak Element|C++ Python|Note|Medium| |162|Missing Ranges|C++ Python|Note|None| |163|Maximum Gap|C++ Python|Note|Hard| |164|Compare Version Numbers|C++ Python|Note|Medium| |165|Fraction to Recurring Decimal|C++ Python|Note|Medium| |166|Two Sum II - Input array is sorted|C++ Python|Note|Easy| |167|Excel Sheet Column Title|C++ Python|Note|Easy| |168|Majority Element|C++ Python|Note|Easy| |169|Two Sum III - Data structure design|C++ Python|Note|None| |170|Excel Sheet Column Number|C++ Python|Note|Easy| |171|Factorial Trailing Zeroes|C++ Python|Note|Easy| |172|Binary Search Tree Iterator|C++ Python|Note|Medium| |173|Dungeon Game|C++ Python|Note|Hard| |174|Combine Two Tables|C++ Python|Note|Easy| |175|Second Highest Salary|C++ Python|Note|Easy| |176|Nth Highest Salary|C++ Python|Note|Medium| |177|Rank Scores|C++ Python|Note|Medium| |178|Largest Number|C++ Python|Note|Medium| |179|Consecutive Numbers|C++ Python|Note|Medium| |180|Employees Earning More Than Their Managers|C++ Python|Note|Easy| |181|Duplicate Emails|C++ Python|Note|Easy| |182|Customers Who Never Order|C++ Python|Note|Easy| |183|Department Highest Salary|C++ Python|Note|Medium| |184|Department Top Three Salaries|C++ Python|Note|Hard| |185|Reverse Words in a String II|C++ Python|Note|None| |186|Repeated DNA Sequences|C++ Python|Note|Medium| |187|Best Time to Buy and Sell Stock IV|C++ Python|Note|Hard| |188|Rotate Array|C++ Python|Note|Easy| |189|Reverse Bits|C++ Python|Note|Easy| |190|Number of 1 Bits|C++ Python|Note|Easy| |191|Word Frequency|C++ Python|Note|Medium| |192|Valid Phone Numbers|C++ Python|Note|Easy| |193|Transpose File|C++ Python|Note|Medium| |194|Tenth Line|C++ Python|Note|Easy| |195|Delete Duplicate Emails|C++ Python|Note|Easy| |196|Rising Temperature|C++ Python|Note|Easy| |197|House Robber|C++ Python|Note|Easy| |198|Binary Tree Right Side View|C++ Python|Note|Medium| |199|Number of Islands|C++ Python|Note|Medium| |200|Bitwise AND of Numbers Range|C++ Python|Note|Medium| |201|Happy Number|C++ Python|Note|Easy| |202|Remove Linked List Elements|C++ Python|Note|Easy| |203|Count Primes|C++ Python|Note|Easy| |204|Isomorphic Strings|C++ Python|Note|Easy| |205|Reverse Linked List|C++ Python|Note|Easy| |206|Course Schedule|C++ Python|Note|Medium| |207|Implement Trie (Prefix Tree)|C++/solution.h) Python/solution.py)|Note)|Medium| |208|Minimum Size Subarray Sum|C++ Python|Note|Medium| |209|Course Schedule II|C++ Python|Note|Medium| |210|Add and Search Word - Data structure design|C++ Python|Note|Medium| |211|Word Search II|C++ Python|Note|Hard| |212|House Robber II|C++ Python|Note|Medium| |213|Shortest Palindrome|C++ Python|Note|Hard| |214|Kth Largest Element in an Array|C++ Python|Note|Medium| |215|Combination Sum III|C++ Python|Note|Medium| |216|Contains Duplicate|C++ Python|Note|Easy| |217|The Skyline Problem|C++ Python|Note|Hard| |218|Contains Duplicate II|C++ Python|Note|Easy| |219|Contains Duplicate III|C++ Python|Note|Medium| |220|Maximal Square|C++ Python|Note|Medium| |221|Count Complete Tree Nodes|C++ Python|Note|Medium| |222|Rectangle Area|C++ Python|Note|Medium| |223|Basic Calculator|C++ Python|Note|Hard| |224|Implement Stack using Queues|C++ Python|Note|Easy| |225|Invert Binary Tree|C++ Python|Note|Easy| |226|Basic Calculator II|C++ Python|Note|Medium| |227|Summary Ranges|C++ Python|Note|Medium| |228|Majority Element II|C++ Python|Note|Medium| |229|Kth Smallest Element in a BST|C++ Python|Note|Medium| |230|Power of Two|C++ Python|Note|Easy| |231|Implement Queue using Stacks|C++ Python|Note|Easy| |232|Number of Digit One|C++ Python|Note|Hard| |233|Palindrome Linked List|C++ Python|Note|Easy| |234|Lowest Common Ancestor of a Binary Search Tree|C++ Python|Note|Easy| |235|Lowest Common Ancestor of a Binary Tree|C++ Python|Note|Medium| |236|Delete Node in a Linked List|C++ Python|Note|Easy| |237|Product of Array Except Self|C++ Python|Note|Medium| |238|Sliding Window Maximum|C++ Python|Note|Hard| |239|Search a 2D Matrix II|C++ Python|Note|Medium| |240|Different Ways to Add Parentheses|C++ Python|Note|Medium| |241|Valid Anagram|C++ Python|Note|Easy| |242|Shortest Word Distance|C++ Python|Note|None| |243|Shortest Word Distance II|C++ Python|Note|None| |244|Shortest Word Distance III|C++ Python|Note|None| |245|Strobogrammatic Number|C++ Python|Note|None| |246|Strobogrammatic Number II|C++ Python|Note|None| |247|Strobogrammatic Number III|C++ Python|Note|None| |248|Group Shifted Strings|C++ Python|Note|None| |249|Count Univalue Subtrees

ยฉ 2026 GitRepoTrend ยท pezy/LeetCode ยท Updated daily from GitHub