Skip to content

DSA Questions Advanced

Coding-interview questions grouped by pattern, so you learn to recognise the technique rather than memorise answers. Every solution is in commented Python with time and space complexity.

Patterns covered

01

Arrays & hashing

Frequency maps, prefix sums, grouping.

Core

02

Two pointers & sliding window

Pairs, longest/shortest windows, deduplication.

Core

03

Binary search

Sorted data, rotated arrays, searching on the answer.

Core

04

Stacks & monotonic stacks

Brackets, next-greater element, histogram areas.

Core

05

Linked lists

Reversal, cycle detection, merging, LRU cache.

Core

06

Trees & BSTs

Traversals, depth, lowest common ancestor, serialisation.

Core

07

Heaps & top-k

K largest, merge k sorted lists, running median.

Intermediate

08

Intervals & greedy

Merging, scheduling, meeting rooms, jump games.

Intermediate

09

Backtracking

Subsets, permutations, combination sums, N-Queens.

Intermediate

10

Graphs

BFS/DFS, islands, topological sort, Dijkstra, cycle detection.

Advanced

11

Dynamic programming

1-D, 2-D grids, knapsack, intervals, strings, bitmask DP.

Advanced

12

Tries & string algorithms

Prefix search, autocomplete, KMP, rolling hash.

Advanced

13

Union-find

Connected components, redundant edges, accounts merge.

Advanced

14

Segment & Fenwick trees

Range queries and updates, counting inversions.

Expert

Every question includes

  • How to spot the pattern from the problem statement
  • Brute force first, then the optimal approach — and why it's faster
  • Commented Python solution and test cases
  • Time and space complexity, plus common follow-ups