Published on

Basic problems to cover for coding interviews

Authors
  • avatar
    Name
    Akshay V Anil
    Twitter

Algorithms and Data Structures for Beginners

  • Search for the corresponding problems on leetcode / Google for problem definitions.

Arrays

  • Static Arrays
    • Suggested Problems: Remove Duplicates from Sorted Array, Remove Element
  • Dynamic Arrays
    • Suggested Problems: Concatenation of Array
    • Custom Problem: dynamicArray
  • Stacks
    • Suggested Problems: Valid Parentheses, Min Stack

Linked Lists

  • Singly Linked Lists
    • Suggested Problems: Reverse Linked List, Merge Two Sorted Lists
    • Custom Problem: singlyLinkedList
  • Doubly Linked Lists
    • Suggested Problems: Design Linked List, Design Browser History
  • Queues
    • Suggested Problems: Number of Students Unable to Eat Lunch, Implement Stack using Queues
    • Custom Problem: queue

Recursion

  • Factorial
    • Suggested Problems: Reverse Linked List
  • Fibonacci Sequence
    • Suggested Problems: Climbing Stairs

Sorting

  • Insertion Sort
    • Custom Problem: insertionSort
  • Merge Sort
    • Suggested Problems: Merge k Sorted Lists
    • Custom Problem: mergeSort
  • Quick Sort
    • Custom Problem: quickSort
  • Bucket Sort
    • Suggested Problems: Sort Colors
  • Search Array
    • Suggested Problems: Binary Search, Search a 2D Matrix
  • Search Range
    • Suggested Problems: Guess Number Higher or Lower, First Bad Version, Koko Eating Bananas

Trees

  • Binary Tree
  • Binary Search Tree
    • Suggested Problems: Search in a Binary Search Tree
  • BST Insert and Remove
    • Suggested Problems: Insert into a Binary Search Tree, Delete Node in a BST
  • Depth-First Search
    • Suggested Problems: Binary Tree Inorder Traversal, Kth Smallest Element in a BST, Construct Binary Tree from Preorder and Inorder Traversal
  • Breadth-First Search
    • Suggested Problems: Binary Tree Level Order Traversal, Binary Tree Right Side View
  • BST Sets and Maps
    • Custom Problem: binarySearchTree

Backtracking

  • Tree Maze
    • Suggested Problems: Path Sum, Subsets, Combination Sum

Heap / Priority Queue

  • Heap Properties
  • Push and Pop
    • Suggested Problems: Kth Largest Element in a Stream
  • Heapify
    • Suggested Problems: Last Stone Weight, K Closest Points to Origin, Kth Largest Element in an Array
    • Custom Problem: heap

Hashing

  • Hash Usage
    • Suggested Problems: Contains Duplicate, Two Sum, LRU Cache
  • Hash Implementation
    • Custom Problem: hashTable

Graphs

  • Intro to Graphs
  • Matrix DFS
    • Suggested Problems: Number of Islands, Max Area of Island
    • Custom Problem: matrixDFS
  • Matrix BFS
    • Suggested Problems: Shortest Path in Binary Matrix, Rotting Oranges
    • Custom Problem: matrixBFS
  • Adjacency List
    • Suggested Problems: Clone Graph, Course Schedule
    • Custom Problem: graph

Dynamic Programming

  • 1-Dimension DP
    • Suggested Problems: Climbing Stairs, House Robber
  • 2-Dimension DP
    • Suggested Problems: Unique Paths, Unique Paths II, Longest Common Subsequence

Bit Manipulation

  • Bit Operations
    • Suggested Problems: Number of 1 Bits, Counting Bits, Reverse Bits

Advanced Algorithms

Sections and Lessons

Arrays

  • Kadane's Algorithm
    • Suggested Problems: Maximum Subarray, Maximum Sum Circular Subarray, Longest Turbulent Subarray
  • Sliding Window Fixed Size
    • Suggested Problems: Contains Duplicate II, Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold
  • Sliding Window Variable Size
    • Suggested Problems: Minimum Size Subarray Sum, Longest Substring without Repeating Characters, Longest Repeating Character Replacement
  • Two Pointers
    • Suggested Problems: Valid Palindrome, Two Sum II Input Array is Sorted, Remove Duplicates from Sorted Array, Remove Duplicates from Sorted Array II, Container with Most Water, Trapping Rain Water
  • Prefix Sums
    • Suggested Problems: Range Sum Query Immutable, Range Sum Query 2D Immutable, Find Pivot Index, Product of Array Except Self, Subarray Sum Equals K

Linked Lists

  • Fast and Slow Pointers
    • Suggested Problems: Middle of the Linked List, Maximum Twin Sum of a Linked List, Linked List Cycle, Linked List Cycle II, Find the Duplicate Number

Trees

  • Trie
    • Suggested Problems: Implement Trie Prefix Tree, Design Add and Search Words Data Structure, Word Search II, Prefix and Suffix Search
  • Union-Find
    • Suggested Problems: Redundant Connection, Accounts Merge, Longest Consecutive Sequence, Number of Connected Components in an Undirected Graph
    • Custom Problem: unionFind
  • Segment Tree
    • Suggested Problems: Range Sum Query Mutable, Queue Reconstruction by Height, My Calendar I, Longest Increasing Subsequence II
    • Custom Problem: segmentTree
  • Iterative DFS
    • Suggested Problems: Binary Search Tree Iterator, Binary Tree Preorder Traversal, Binary Tree Postorder Traversal

Heaps

  • Two Heaps
    • Suggested Problems: Find Median from Data Stream, Sliding Window Median, IPO

Backtracking

  • Subsets
    • Suggested Problems: Subsets, Subsets II
  • Combinations
    • Suggested Problems: Combinations, Combination Sum, Letter Combinations of a Phone Number
  • Permutations
    • Suggested Problems: Permutations, Permutations II

Graphs

  • Dijkstra's
    • Suggested Problems: Network Delay Time, Swim in Rising Water, Path with Maximum Probability
    • Custom Problem: dijkstra
  • Prim's
    • Suggested Problems: Min Cost to Connect All Points, Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
    • Custom Problem: prim
  • Kruskal's
    • Suggested Problems: Min Cost to Connect All Points, Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
    • Custom Problem: kruskal
  • Topological Sort
    • Suggested Problems: Course Schedule, Course Schedule II, Course Schedule IV, Sort Items by Groups Respecting Dependencies, Alien Dictionary
    • Custom Problem: topologicalSort

Dynamic Programming

  • 0 / 1 Knapsack
    • Suggested Problems: Partition Equal Subset Sum, Target Sum, Ones and Zeroes, Last Stone Weight II
    • Custom Problem: zeroOneKnapsack
  • Unbounded Knapsack
    • Suggested Problems: Coin Change, Coin Change II, Minimum Cost for Tickets
    • Custom Problem: unboundedKnapsack
  • LCS
    • Suggested Problems: Longest Common Subsequence, Distinct Subsequences, Edit Distance, Interleaving String, Shortest Common Supersequence
  • Palindromes
    • Suggested Problems: Longest Palindromic Substring, Palindromic Substrings, Longest Palindromic Subsequence