Skip to content
Codeloom

Topics / Arrays

🔢

Arrays

The most common interview topic — and the building block of almost every other data structure.

Why learn Arrays?

  • Show up in 30%+ of coding interviews.

  • Foundation for two-pointer, sliding window, and prefix-sum patterns.

  • Easy to start, deep enough to keep you sharp for years.

What you can build with Arrays

Two-pointer and sliding-window problems Prefix-sum and difference-array tricks Matrix and 2D grid problems

Arrays tutorials

15 articles · page 1 of 1

Hand-written tutorials, ordered as a recommended learning path.

  1. 01 Binary Search Master binary search patterns for LeetCode including search space reduction, boundary finding, rotated array search, and practical templates.
  2. 02 Buy & Sell II Solve the multi-transaction stock problem with the greedy peak-valley insight: sum every positive daily delta. Includes complexity analysis and DP alternative.
  3. 03 Ship Packages Solve Capacity to Ship Packages Within D Days by binary searching the ship capacity. Includes feasibility check, tight bounds, and a worked example.
  4. 04 Contains Duplicate A clear walkthrough of the Contains Duplicate problem, covering brute force, sorting, and the optimal hash set approach with complexity analysis.
  5. 05 Find Peak Element Solve Find Peak Element in O(log n) by binary searching on the slope direction. Includes diagram and edge cases.
  6. 06 Koko Bananas Solve Koko Eating Bananas by binary searching the eating speed. Includes the monotonic predicate, ceiling division, and complexity.
  7. 07 Majority Element Solve Majority Element in O(n) time and O(1) space using Boyer-Moore majority vote. Includes intuition, walkthrough, and edge cases.
  8. 08 Missing Number Solve the Missing Number problem with three approaches: hashing, Gauss sum formula, and XOR. Includes complexity analysis and interview tips.
  9. 09 Move Zeroes Solve Move Zeroes in O(n) time and O(1) space using a write pointer. Includes walkthrough, edge cases, and interview tips.
  10. 10 Pascal's Triangle Build Pascal's Triangle in O(n^2) time using simple row-by-row addition. Includes a clear diagram, edge cases, and complexity analysis.
  11. 11 Plus One Add one to a big integer stored as a digit array by walking from the back. Includes carry handling, the all-nines edge case, and complexity analysis.
  12. 12 Remove Duplicates Solve Remove Duplicates from Sorted Array in O(n) time and O(1) space with the two-pointer write-pointer pattern. Includes walkthrough, edge cases, and complexity.
  13. 13 Set Matrix Zeroes Solve Set Matrix Zeroes in place using the first row and column as markers. Includes a step-by-step walkthrough and edge cases.
  14. 14 Single Number Solve the Single Number problem in O(n) time and O(1) space using XOR. Includes a walkthrough, edge cases, and follow-up variants.
  15. 15 Two Pointers Master every two pointer pattern for LeetCode: opposite-end, same-direction, and fast/slow pointers with templates, complexity analysis, and 15+ mapped problems.