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.
432 answers
- 209.Minimum Size Subarray SumMedium
- 211.Design Add and Search Words Data StructureMedium
- 213.House Robber IIMedium
- 215.Kth Largest Element in an ArrayMedium
- 216.Combination Sum IIIMedium
- 221.Maximal SquareMedium
- 223.Rectangle AreaMedium
- 227.Basic Calculator IIMedium
- 229.Majority Element IIMedium
- 230.Kth Smallest Element in a BSTMedium
- 235.Lowest Common Ancestor of a Binary Search TreeMedium
- 236.Lowest Common Ancestor of a Binary TreeMedium
- 237.Delete Node in a Linked ListMedium
- 240.Search a 2D Matrix IIMedium
- 241.Different Ways to Add ParenthesesMedium
- 244.Shortest Word Distance IIMedium
- 245.Shortest Word Distance IIIMedium
- 247.Strobogrammatic Number IIMedium
- 249.Group Shifted StringsMedium
- 250.Count Univalue SubtreesMedium
- 254.Factor CombinationsMedium
- 255.Verify Preorder Sequence in Binary Search TreeMedium
- 259.3Sum SmallerMedium
- 260.Single Number IIIMedium
- 261.Graph Valid TreeMedium
- 264.Ugly Number IIMedium
- 267.Palindrome Permutation IIMedium
- 271.Encode and Decode StringsMedium
- 274.H-IndexMedium
- 277.Find the CelebrityMedium
- 280.Wiggle SortMedium
- 281.Zigzag IteratorMedium
- 284.Peeking IteratorMedium
- 285.Inorder Successor in BSTMedium
- 286.Walls and GatesMedium
- 287.Find the Duplicate NumberMedium
- 288.Unique Word AbbreviationMedium
- 289.Game of LifeMedium
- 291.Word Pattern IIMedium
- 294.Flip Game IIMedium
- 298.Binary Tree Longest Consecutive SequenceMedium
- 299.Bulls and CowsMedium
- 300.Longest Increasing SubsequenceMedium
- 304.Range Sum Query 2D - ImmutableMedium
- 306.Additive NumberMedium
- 308.Range Sum Query 2D - MutableMedium
- 309.Best Time to Buy and Sell Stock with CooldownMedium
- 311.Sparse Matrix MultiplicationMedium
- 313.Super Ugly NumberMedium
- 314.Binary Tree Vertical Order TraversalMedium
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.