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.
166 answers
- 1.Two SumEasy
- 9.Palindrome NumberEasy
- 13.Roman to IntegerEasy
- 14.Longest Common PrefixEasy
- 20.Valid ParenthesesEasy
- 21.Merge Two Sorted ListsEasy
- 27.Remove ElementEasy
- 28.Find the Index of the First Occurrence in a StringEasy
- 35.Search Insert PositionEasy
- 58.Length of Last WordEasy
- 66.Plus OneEasy
- 67.Add BinaryEasy
- 69.Sqrt(x)Easy
- 70.Climbing StairsEasy
- 83.Remove Duplicates from Sorted ListEasy
- 88.Merge Sorted ArrayEasy
- 94.Binary Tree Inorder TraversalEasy
- 100.Same TreeEasy
- 101.Symmetric TreeEasy
- 104.Maximum Depth of Binary TreeEasy
- 111.Minimum Depth of Binary TreeEasy
- 112.Path SumEasy
- 118.Pascal's TriangleEasy
- 119.Pascal's Triangle IIEasy
- 121.Best Time to Buy and Sell StockEasy
- 125.Valid PalindromeEasy
- 136.Single NumberEasy
- 141.Linked List CycleEasy
- 144.Binary Tree Preorder TraversalEasy
- 145.Binary Tree Postorder TraversalEasy
- 157.Read N Characters Given Read4Easy
- 160.Intersection of Two Linked ListsEasy
- 163.Missing RangesEasy
- 168.Excel Sheet Column TitleEasy
- 169.Majority ElementEasy
- 170.Two Sum III - Data structure designEasy
- 171.Excel Sheet Column NumberEasy
- 190.Reverse BitsEasy
- 191.Number of 1 BitsEasy
- 202.Happy NumberEasy
- 203.Remove Linked List ElementsEasy
- 206.Reverse Linked ListEasy
- 219.Contains Duplicate IIEasy
- 222.Count Complete Tree NodesEasy
- 225.Implement Stack using QueuesEasy
- 226.Invert Binary TreeEasy
- 231.Power of TwoEasy
- 232.Implement Queue using StacksEasy
- 234.Palindrome Linked ListEasy
- 242.Valid AnagramEasy
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.