kamiak.org

Begniner Coding Problems

I tried to cover as much as I could, but I skipped Binary Tree in intermediate because I thought the other algorithms were more important. These are interview problems, so they should be quite challenging. Solutions

Beginner

  1. Index of Character in String Without indexOf (Linear Search)
  2. Sum of 2D Array (Basic Traversal of 2D Array)
  3. N Factorial (Basic Index Manipulation)
  4. FizzBuzz [412] (Stacked If-Statements)
  5. Index of Substring in String Without indexOf [28] (Linear Search, Index Manipulation)
  6. Two Numbers in Array That Add to Target [1] (Special Traversal of 2D Array)
  7. Nth Term of Fibonacci Sequence [509] (Recursion/Repitition)
  8. Binary Search [704] (Basic Sorted Array Manipulation)
  9. Sort Array of 0s, 1s, and 2s In-Place [75] (Simple Counting Sort)
  10. Most Occuring Number in Array, aka Mode (Map)

Intermediate

  1. Minimum Cost Climbing Stairs [746] (Dynamic Programming)
  2. Longest Common Prefix of String Array [14] (Jagged Array)
  3. Two Numbers in Array That Add to Target in O(n) [1] (HashMap/HashSet)
  4. Rotate 2D Array [48] (2D Array Index Manipulation)
  5. Sort Numbers From -50,000 to 50,000 [912] (MergeSort/RadixSort)
  6. Valid Parentheses [20] (Stack)
  7. Letter Combinations of a Phone Number [17] (Combinations)
  8. Group Anagrams [49] (HashMap, String)
  9. Container With Most Water [11] (Two Pointer, Greedy)
  10. Minimum Path Sum [64] (Dynamic Programming)

Advanced

  1. Find First and Last Position of Element in O(log n) [34] (Two Pointer, Binary Search)
  2. Merge Intervals [56] (Array)
  3. Merge k Sorted Lists [23] (LinkedList)
  4. Reverse Nodes in k-Group [25] (LinkedList)
  5. Combination Sum [39] (Combinations)
  6. First Missing Positive in O(n) Time and O(k) Extra Memory [41] (Memory Manipulation)
  7. Maximum Path Sum [124] (Binary Tree, Dynamic Programming)
  8. Longest Valid Parentheses [32] (Stack)
  9. Trapping Rain Water [42] (Two Pointer)
  10. Largest Rectangle in Histogram [84] (Monotonic Stack)