Why this set of 25 problems?
Quick reference: When to use what
| Structure | Operation | Time | Space | Use Case |
|---|---|---|---|---|
list |
append, pop, access | O(1) | O(n) | Ordered, frequency iteration |
dict |
lookup, insert, delete | O(1) avg | O(n) | Fast key-value, counting |
set |
add, remove, check | O(1) avg | O(n) | Dedup, membership test |
tuple |
access, unpacking | O(1) | O(n) | Immutable, hash keys |
collections.deque |
append, popleft | O(1) | O(n) | Queue, sliding window |
Lists & Arrays (6 problems)
Hash Maps & Sets (5 problems)
Stacks & Queues (4 problems)
Linked Lists (3 problems)
Trees (3 problems)
Two Pointers & Sliding Window (4 problems)
Pattern recognition: When to reach for what
Choose your data structure
dict or Counter
set
deque or list
list.append() / list.pop() or deque
What patterns dominate at Indian & Kenyan fintechs?
SouthBank India (โน transactions): Hash maps for fraud detection (fast lookup by account), two-pointer for reconciliation loops.
Razorpay (payments): Sliding windows for rate-limit checks, stacks for undo/redo, hash maps for idempotency keys.
M-Pesa Kenya (KSh transfers): Queues for transaction batching, deque for time-window rolling sums.
Safaricom, Twiga: Tree structures for regional hierarchies; two-pointer for list reconciliation.
All of them: Master hash maps, two-pointer, and sliding window. That's 60% of your interview.
Quick check: Do you know when to use what?
5 common interview follow-ups
nums[::-1] but that creates a copy. The pointer approach is what they want to see.
from collections import deque.
heapq.nlargest(k, nums) in Python.
sorted() is O(n log n) Timsort, guaranteed stable. Quicksort O(n log n) avg, O(nยฒ) worst. Mergesort O(n log n) always. For interviews, just say "I use Python's sort" unless they ask for a custom algorithm. Know when to avoid O(nยฒ) brute force.
Live mock interviews with senior engineers
Join the Best AI Program: The AI-Era Analyst โ 5 months, fully online, with placement assistance. Week 1 is free.
Explore The AI-Era Analyst โ