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.
156 answers
- 4.Median of Two Sorted ArraysHard
- 23.Merge k Sorted ListsHard
- 25.Reverse Nodes in k-GroupHard
- 30.Substring with Concatenation of All WordsHard
- 32.Longest Valid ParenthesesHard
- 37.Sudoku SolverHard
- 41.First Missing PositiveHard
- 42.Trapping Rain WaterHard
- 44.Wildcard MatchingHard
- 51.N-QueensHard
- 52.N-Queens IIHard
- 60.Permutation SequenceHard
- 65.Valid NumberHard
- 68.Text JustificationHard
- 76.Minimum Window SubstringHard
- 84.Largest Rectangle in HistogramHard
- 85.Maximal RectangleHard
- 87.Scramble StringHard
- 124.Binary Tree Maximum Path SumHard
- 126.Word Ladder IIHard
- 127.Word LadderHard
- 132.Palindrome Partitioning IIHard
- 140.Word Break IIHard
- 149.Max Points on a LineHard
- 154.Find Minimum in Rotated Sorted Array IIHard
- 158.Read N Characters Given read4 II - Call Multiple TimesHard
- 174.Dungeon GameHard
- 188.Best Time to Buy and Sell Stock IVHard
- 212.Word Search IIHard
- 214.Shortest PalindromeHard
- 218.The Skyline ProblemHard
- 220.Contains Duplicate IIIHard
- 224.Basic CalculatorHard
- 233.Number of Digit OneHard
- 239.Sliding Window MaximumHard
- 248.Strobogrammatic Number IIIHard
- 265.Paint House IIHard
- 269.Alien DictionaryHard
- 272.Closest Binary Search Tree Value IIHard
- 273.Integer to English WordsHard
- 282.Expression Add OperatorsHard
- 295.Find Median from Data StreamHard
- 296.Best Meeting PointHard
- 297.Serialize and Deserialize Binary TreeHard
- 301.Remove Invalid ParenthesesHard
- 302.Smallest Rectangle Enclosing Black PixelsHard
- 305.Number of Islands IIHard
- 312.Burst BalloonsHard
- 315.Count of Smaller Numbers After SelfHard
- 317.Shortest Distance from All BuildingsHard
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.