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
- 243.Shortest Word DistanceEasy
- 244.Shortest Word Distance IIMedium
- 245.Shortest Word Distance IIIMedium
- 247.Strobogrammatic Number IIMedium
- 248.Strobogrammatic Number IIIHard
- 249.Group Shifted StringsMedium
- 250.Count Univalue SubtreesMedium
- 252.Meeting RoomsEasy
- 254.Factor CombinationsMedium
- 255.Verify Preorder Sequence in Binary Search TreeMedium
- 257.Binary Tree PathsEasy
- 258.Add DigitsEasy
- 259.3Sum SmallerMedium
- 260.Single Number IIIMedium
- 261.Graph Valid TreeMedium
- 263.Ugly NumberEasy
- 264.Ugly Number IIMedium
- 265.Paint House IIHard
- 267.Palindrome Permutation IIMedium
- 268.Missing NumberEasy
- 269.Alien DictionaryHard
- 270.Closest Binary Search Tree ValueEasy
- 271.Encode and Decode StringsMedium
- 272.Closest Binary Search Tree Value IIHard
- 273.Integer to English WordsHard
- 274.H-IndexMedium
- 277.Find the CelebrityMedium
- 278.First Bad VersionEasy
- 280.Wiggle SortMedium
- 281.Zigzag IteratorMedium
- 282.Expression Add OperatorsHard
- 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
- 292.Nim GameEasy
- 294.Flip Game IIMedium
- 295.Find Median from Data StreamHard
- 296.Best Meeting PointHard
- 297.Serialize and Deserialize Binary TreeHard
- 298.Binary Tree Longest Consecutive SequenceMedium
- 299.Bulls and CowsMedium
- 300.Longest Increasing SubsequenceMedium
- 301.Remove Invalid ParenthesesHard
- 302.Smallest Rectangle Enclosing Black PixelsHard
- 303.Range Sum Query - ImmutableEasy
- 304.Range Sum Query 2D - ImmutableMedium
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.