Algorithms and Data Structures

Video walkthroughs of classic algorithm and data-structure problems, explained step by step in Python.

Video Lessons

Two Sum - Leetcode 1 - Python

1. Two Sum - Leetcode 1 - Python

Longest Substring Without Repeating Characters - Leetcode 3 - Python

2. Longest Substring Without Repeating Characters - Leetcode 3 - Python

Longest Palindromic Substring - Leetcode 5  - Python

3. Longest Palindromic Substring - Leetcode 5 - Python

Container With Most Water - Leetcode 11 - Python

4. Container With Most Water - Leetcode 11 - Python

Triplet Sum - Leetcode 15  - Python

5. Triplet Sum - Leetcode 15 - Python

Remove Nth Node From End of List - Leetcode 19  - Python

6. Remove Nth Node From End of List - Leetcode 19 - Python

Valid Parentheses - Leetcode 20  - Python

7. Valid Parentheses - Leetcode 20 - Python

Merge Two Sorted Lists - Leetcode 21  - Python

8. Merge Two Sorted Lists - Leetcode 21 - Python

Merge k Sorted Lists - Leetcode 23  - Python

9. Merge k Sorted Lists - Leetcode 23 - Python

Search in Rotated Sorted Array - Leetcode 33  - Python

10. Search in Rotated Sorted Array - Leetcode 33 - Python

Combination Sum - Leetcode 39 - Python

11. Combination Sum - Leetcode 39 - Python

Rotate Image - Leetcode 48 - Python

12. Rotate Image - Leetcode 48 - Python

Group Anagrams - Leetcode 49 - Python

13. Group Anagrams - Leetcode 49 - Python

Maximum Subarray - Leetcode 53 - Python

14. Maximum Subarray - Leetcode 53 - Python

Spiral Matrix - Leetcode 54 - Python

15. Spiral Matrix - Leetcode 54 - Python

Jump Game - Leetcode 55 - Python

16. Jump Game - Leetcode 55 - Python

Merge Intervals - Leetcode 56 - Python

17. Merge Intervals - Leetcode 56 - Python

Insert Interval - Leetcode 57 - Python

18. Insert Interval - Leetcode 57 - Python

Unique Paths - Leetcode 62 - Python

19. Unique Paths - Leetcode 62 - Python

Climbing Stairs - Leetcode 70 - Python

20. Climbing Stairs - Leetcode 70 - Python

Set Matrix Zeroes - Leetcode 73 - Python

21. Set Matrix Zeroes - Leetcode 73 - Python

Minimum Window Substring - Leetcode 76 - Python

22. Minimum Window Substring - Leetcode 76 - Python

Word Search - Leetcode 79 - Python

23. Word Search - Leetcode 79 - Python

Decode Ways - Leetcode 91 - Python

24. Decode Ways - Leetcode 91 - Python

Validate Binary Search Tree - Leetcode 98 - Python

25. Validate Binary Search Tree - Leetcode 98 - Python

Same Tree - Leetcode 100 - Python

26. Same Tree - Leetcode 100 - Python

Binary Tree Level Order Traversal - Leetcode 102 - Python

27. Binary Tree Level Order Traversal - Leetcode 102 - Python

Maximum Depth of Binary Tree - Leetcode 104 - Python

28. Maximum Depth of Binary Tree - Leetcode 104 - Python

Construct Binary Tree from Preorder and Inorder Traversal - Leetcode 105 - Python

29. Construct Binary Tree from Preorder and Inorder Traversal - Leetcode 105 - Python

Best Time to Buy and Sell - Leetcode 121 - Python

30. Best Time to Buy and Sell - Leetcode 121 - Python

Binary Tree Maximum Path Sum - Leetcode 124 - Python

31. Binary Tree Maximum Path Sum - Leetcode 124 - Python

Valid Palindrome - Leetcode 125 - Python

32. Valid Palindrome - Leetcode 125 - Python

Longest Consecutive Sequence - Leetcode 128 - Python

33. Longest Consecutive Sequence - Leetcode 128 - Python

Clone Graph - Leetcode 133 - Python

34. Clone Graph - Leetcode 133 - Python

Word Break - Leetcode 139 - Python

35. Word Break - Leetcode 139 - Python

Linked List Cycle - Leetcode 141 - Python

36. Linked List Cycle - Leetcode 141 - Python

Reorder List - Leetcode 143  - Python

37. Reorder List - Leetcode 143 - Python

Maximum Product Subarray - Leetcode 152  - Python

38. Maximum Product Subarray - Leetcode 152 - Python

Find Minimum in Rotated Sorted Array - Leetcode 153  - Python

39. Find Minimum in Rotated Sorted Array - Leetcode 153 - Python

Reverse Bits - Leetcode 190 - Python

40. Reverse Bits - Leetcode 190 - Python

Number of 1 Bits - Leetcode 191 - Python

41. Number of 1 Bits - Leetcode 191 - Python

House Robber - Leetcode 198 - Python

42. House Robber - Leetcode 198 - Python

Number of Islands - Leetcode 200 - Python

43. Number of Islands - Leetcode 200 - Python

Reverse Linked List - Leetcode 206 - Python

44. Reverse Linked List - Leetcode 206 - Python

Course Schedule - Leetcode 207 - Python

45. Course Schedule - Leetcode 207 - Python

Implement Trie (Prefix Tree) - Leetcode 208 - Python

46. Implement Trie (Prefix Tree) - Leetcode 208 - Python

Course Schedule II - Leetcode 210 - Python

47. Course Schedule II - Leetcode 210 - Python

Design Add and Search Words Data Structure - Leetcode 211 - Python

48. Design Add and Search Words Data Structure - Leetcode 211 - Python

Word Search II - Leetcode 212 - Python

49. Word Search II - Leetcode 212 - Python

House Robber II - Leetcode 213 - Python

50. House Robber II - Leetcode 213 - Python

Contains Duplicate - Leetcode 217 - Python

51. Contains Duplicate - Leetcode 217 - Python

Invert Binary Tree - Leetcode 226 - Python

52. Invert Binary Tree - Leetcode 226 - Python

Kth Smallest Element in a BST - Leetcode 230 - Python

53. Kth Smallest Element in a BST - Leetcode 230 - Python

Lowest Common Ancestor of a Binary Search Tree - Leetcode 235 - Python

54. Lowest Common Ancestor of a Binary Search Tree - Leetcode 235 - Python

Product of Array Except Self - Leetcode 238 - Python

55. Product of Array Except Self - Leetcode 238 - Python

Valid Anagram - Leetcode 242 - Python

56. Valid Anagram - Leetcode 242 - Python

Missing Number - Leetcode 268  - Python

57. Missing Number - Leetcode 268 - Python

Find Median from Data Stream - Leetcode 295 - Python

58. Find Median from Data Stream - Leetcode 295 - Python

Serialize and Deserialize Binary Tree - Leetcode 297 - Python

59. Serialize and Deserialize Binary Tree - Leetcode 297 - Python

Longest Increasing Subsequence  - Leetcode 300 - Python

60. Longest Increasing Subsequence - Leetcode 300 - Python

Coin Change - Leetcode 322 - Python

61. Coin Change - Leetcode 322 - Python

Counting Bits - Leetcode 338 - Python

62. Counting Bits - Leetcode 338 - Python

Top K Frequent Elements - Leetcode 347 - Python

63. Top K Frequent Elements - Leetcode 347 - Python

Sum of Two Integers - Leetcode 371 - Python

64. Sum of Two Integers - Leetcode 371 - Python

Pacific Atlantic Water Flow - Leetcode 417 - Python

65. Pacific Atlantic Water Flow - Leetcode 417 - Python

Longest Repeating Character Replacement - Leetcode 424 - Python

66. Longest Repeating Character Replacement - Leetcode 424 - Python

Non-overlapping Intervals - Leetcode 435 - Python

67. Non-overlapping Intervals - Leetcode 435 - Python

Subtree of Another Tree - Leetcode 572 - Python

68. Subtree of Another Tree - Leetcode 572 - Python

Can Place Flowers - Leetcode 605 - Python

69. Can Place Flowers - Leetcode 605 - Python

Maximum Length Of Pair Chain - Leetcode 646 - Python

70. Maximum Length Of Pair Chain - Leetcode 646 - Python

Palindromic Substrings - Leetcode 647 - Python

71. Palindromic Substrings - Leetcode 647 - Python

Shortest Path Visiting All Nodes - Leetcode 847 - Python

72. Shortest Path Visiting All Nodes - Leetcode 847 - Python

Maximize Distance to Closest Person - Leetcode 849 - Python

73. Maximize Distance to Closest Person - Leetcode 849 - Python

Partition Array for Maximum Sum - Leetcode 1043 - Python

74. Partition Array for Maximum Sum - Leetcode 1043 - Python

Longest Common Subsequence - Leetcode 1143 - Python

75. Longest Common Subsequence - Leetcode 1143 - Python

Largest Color Value in a Directed Graph - Leetcode 1857 - Python

76. Largest Color Value in a Directed Graph - Leetcode 1857 - Python