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.
431 answers
- 2.Add Two NumbersMedium
- 3.Longest Substring Without Repeating CharactersMedium
- 5.Longest Palindromic SubstringMedium
- 7.Reverse IntegerMedium
- 8.String to Integer (atoi)Medium
- 11.Container With Most WaterMedium
- 12.Integer to RomanMedium
- 15.3SumMedium
- 16.3Sum ClosestMedium
- 17.Letter Combinations of a Phone NumberMedium
- 18.4SumMedium
- 19.Remove Nth Node From End of ListMedium
- 22.Generate ParenthesesMedium
- 24.Swap Nodes in PairsMedium
- 29.Divide Two IntegersMedium
- 31.Next PermutationMedium
- 33.Search in Rotated Sorted ArrayMedium
- 34.Find First and Last Position of Element in Sorted ArrayMedium
- 36.Valid SudokuMedium
- 38.Count and SayMedium
- 40.Combination Sum IIMedium
- 43.Multiply StringsMedium
- 45.Jump Game IIMedium
- 46.PermutationsMedium
- 47.Permutations IIMedium
- 48.Rotate ImageMedium
- 49.Group AnagramsMedium
- 50.Pow(x, n)Medium
- 53.Maximum SubarrayMedium
- 54.Spiral MatrixMedium
- 55.Jump GameMedium
- 56.Merge IntervalsMedium
- 57.Insert IntervalMedium
- 59.Spiral Matrix IIMedium
- 61.Rotate ListMedium
- 62.Unique PathsMedium
- 63.Unique Paths IIMedium
- 64.Minimum Path SumMedium
- 71.Simplify PathMedium
- 72.Edit DistanceMedium
- 73.Set Matrix ZeroesMedium
- 74.Search a 2D MatrixMedium
- 75.Sort ColorsMedium
- 77.CombinationsMedium
- 78.SubsetsMedium
- 79.Word SearchMedium
- 80.Remove Duplicates from Sorted Array IIMedium
- 81.Search in Rotated Sorted Array IIMedium
- 82.Remove Duplicates from Sorted List IIMedium
- 86.Partition ListMedium
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.