LeetCode
LeetCode Question Answers
How to solve LeetCode problems in a coding interview: the idea behind each solution and a working answer in Python, Java, C++ and TypeScript. Open the original problem on LeetCode, try it yourself, then compare with our answer. New answers are added every day.
754 answers
- 107.Binary Tree Level Order Traversal IIMedium
- 111.Minimum Depth of Binary TreeEasy
- 112.Path SumEasy
- 113.Path Sum IIMedium
- 114.Flatten Binary Tree to Linked ListMedium
- 116.Populating Next Right Pointers in Each NodeMedium
- 117.Populating Next Right Pointers in Each Node IIMedium
- 118.Pascal's TriangleEasy
- 119.Pascal's Triangle IIEasy
- 121.Best Time to Buy and Sell StockEasy
- 122.Best Time to Buy and Sell Stock IIMedium
- 124.Binary Tree Maximum Path SumHard
- 125.Valid PalindromeEasy
- 126.Word Ladder IIHard
- 127.Word LadderHard
- 129.Sum Root to Leaf NumbersMedium
- 130.Surrounded RegionsMedium
- 131.Palindrome PartitioningMedium
- 132.Palindrome Partitioning IIHard
- 133.Clone GraphMedium
- 136.Single NumberEasy
- 137.Single Number IIMedium
- 138.Copy List with Random PointerMedium
- 139.Word BreakMedium
- 140.Word Break IIHard
- 141.Linked List CycleEasy
- 142.Linked List Cycle IIMedium
- 143.Reorder ListMedium
- 144.Binary Tree Preorder TraversalEasy
- 145.Binary Tree Postorder TraversalEasy
- 146.LRU CacheMedium
- 148.Sort ListMedium
- 149.Max Points on a LineHard
- 150.Evaluate Reverse Polish NotationMedium
- 151.Reverse Words in a StringMedium
- 152.Maximum Product SubarrayMedium
- 153.Find Minimum in Rotated Sorted ArrayMedium
- 154.Find Minimum in Rotated Sorted Array IIHard
- 156.Binary Tree Upside DownMedium
- 157.Read N Characters Given Read4Easy
- 158.Read N Characters Given read4 II - Call Multiple TimesHard
- 159.Longest Substring with At Most Two Distinct CharactersMedium
- 160.Intersection of Two Linked ListsEasy
- 161.One Edit DistanceMedium
- 162.Find Peak ElementMedium
- 163.Missing RangesEasy
- 164.Maximum GapMedium
- 165.Compare Version NumbersMedium
- 166.Fraction to Recurring DecimalMedium
- 167.Two Sum II - Input Array Is SortedMedium
Beyond LeetCode
Real interviews also test system design, SQL, machine learning and behavioral answers. Practise those with KatInterview problems, browse by topic, or read our company interview guides.
LeetCode is a trademark of LeetCode LLC. KatInterview is not affiliated with LeetCode.