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
- 485.Max Consecutive OnesEasy
- 487.Max Consecutive Ones IIMedium
- 488.Zuma GameHard
- 489.Kth Smallest InstructionsHard
- 490.The MazeMedium
- 492.Construct the RectangleEasy
- 493.Reverse PairsHard
- 494.Target SumMedium
- 495.Teemo AttackingEasy
- 496.Next Greater Element IEasy
- 498.Diagonal TraverseMedium
- 499.The Maze IIIHard
- 501.Find Mode in Binary Search TreeEasy
- 502.IPOHard
- 503.Next Greater Element IIMedium
- 504.Base 7Easy
- 505.The Maze IIMedium
- 506.Relative RanksEasy
- 507.Perfect NumberEasy
- 508.Most Frequent Subtree SumMedium
- 509.Inorder Successor in BST IIMedium
- 510.Count Subarrays With More Ones Than ZerosMedium
- 511.All Paths from Source Lead to DestinationMedium
- 512.Maximum Alternating Subarray SumMedium
- 513.Find Bottom Left Tree ValueMedium
- 514.Freedom TrailHard
- 515.Find Largest Value in Each Tree RowMedium
- 517.Super Washing MachinesHard
- 518.Coin Change IIMedium
- 519.Widest Pair of Indices With Equal Range SumMedium
- 520.Detect CapitalEasy
- 521.Longest Uncommon Subsequence IEasy
- 524.Longest Word in Dictionary through DeletingMedium
- 525.Contiguous ArrayMedium
- 527.Word AbbreviationHard
- 528.Swapping Nodes in a Linked ListMedium
- 530.Minimum Absolute Difference in BSTEasy
- 531.Lonely Pixel IMedium
- 532.K-diff Pairs in an ArrayMedium
- 533.Lonely Pixel IIMedium
- 535.Encode and Decode TinyURLMedium
- 536.Construct Binary Tree from StringMedium
- 537.Complex Number MultiplicationMedium
- 539.Minimum Time DifferenceMedium
- 541.Reverse String IIEasy
- 542.01 MatrixMedium
- 543.Diameter of Binary TreeEasy
- 544.Output Contest MatchesMedium
- 545.Boundary of Binary TreeMedium
- 547.Number of ProvincesMedium
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.