Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

⚡ Playlist

Top Last Minute SWE DSA Revision Interview Questions

Essential coding patterns to recognize and recall before interviews

0%

Overall Progress

0 solved / 0 total

Easy0/0
Medium0/0
Hard0/0
Hash MapStore values or frequencies for O(1) average lookup
Prefix SumConvert range queries into differences of prefix values
Medium
Prefix XORUse XOR prefix values to cancel repeated elements
Medium
KadaneTrack the best subarray ending at the current position
Medium
Cyclic SortPlace each value at its correct index
Dutch National FlagMaintain low, middle and high regions
Medium
Opposite PointersMove left/right based on whether the current value is too small or too large
Medium
Same DirectionUse one pointer to scan and another to maintain the valid region
Fast & SlowMove pointers at different speeds to detect structure
Merge PointersCompare current elements and advance the smaller one
Fixed WindowAdd the new element and remove the element leaving the window
Variable WindowExpand until invalid, then shrink until valid
Medium
Frequency WindowMaintain frequencies and track when the window satisfies the requirement
Window Max / MinUse a monotonic deque to keep useful candidates
Classic SearchDiscard half of the search space each step
Lower / Upper BoundBinary search for the boundary rather than an exact value
Medium
Rotated SearchIdentify which half is sorted and decide where the target can exist
Medium
Peak SearchUse slope direction to eliminate half the array
Medium
Search on AnswerBinary search the answer and check whether a candidate is feasible
Medium
ReverseMaintain previous, current and next pointers
Fast & SlowUse two pointers moving at different speeds
MergeCompare nodes and connect the smaller node
Split → Reverse → MergeSplit the list, reverse one half, then merge both halves
Medium
Cache DesignCombine HashMap with doubly linked list
Medium
StackLast in, first out
Monotonic StackMaintain an increasing or decreasing stack of useful candidates
Medium
QueueProcess elements in arrival order
Medium
Monotonic DequeRemove dominated elements while preserving useful candidates
Merge IntervalsSort by start and merge whenever intervals overlap
Medium
Interval SchedulingUsually sort by ending time and greedily choose the earliest finish
Medium
Meeting SchedulingSort events or use a min-heap to track active meetings
Medium
Sweep LineConvert intervals into sorted start/end events
Medium
Top KMaintain only the K most useful candidates with a heap
Medium
Two HeapsMax-heap for lower half and min-heap for upper half
Merge KHeap stores the smallest current element from each source
Heap SchedulingUse a heap to dynamically select the next candidate
Tree DFSSolve children first and combine their results
Tree BFSProcess nodes level by level with a queue
Medium
Tree PathReturn useful information upward while updating the global answer
BSTLeft < Root < Right; inorder traversal is sorted
Medium
Lowest Common AncestorFind where the paths to the two nodes split
Medium
Tree ConstructionUse one traversal to identify the root and another to divide subtrees
Medium
Serialize / DeserializeEncode structure and null nodes so the exact tree can be reconstructed
Graph DFSVisit deeply while tracking visited nodes
Medium
Graph BFSFirst visit to a node gives its shortest distance
Medium
Grid BFS / DFSTreat cells as graph nodes and explore four/eight directions
Multi-Source BFSPut all sources into the queue initially
Medium
Topological SortOrder nodes so every dependency appears before its dependent
Medium
Union FindTrack connected components with parent and rank/size
Medium
DijkstraRepeatedly finalize the currently closest node
Medium
Bellman-FordRelax all edges repeatedly
Medium
Floyd-WarshallAllow each node to become an intermediate point
Medium
Minimum Spanning TreeUse Prim or Kruskal to select minimum-cost edges without cycles
Medium
BridgesUse DFS low-link times to identify critical edges
SubsetsChoose → explore → undo
Medium
PermutationsChoose an unused element at each position
Medium
CombinationsExplore choices while controlling the starting index
Medium
Grid BacktrackingMark → explore → unmark
Medium
Constraint SearchTry a candidate, prune invalid states, then backtrack
Local BestChoose the locally optimal option and prove it cannot hurt the future
Medium
Greedy + SortingSort first, then repeatedly make the optimal local choice
Medium
Greedy + HeapUse a heap to always access the best current option
Medium
1D DPDefine state → transition → base case
Grid DPBuild each cell from previously solved neighboring cells
Medium
0/1 KnapsackState represents position and remaining capacity/target
Medium
Unbounded KnapsackAllow the same item to contribute multiple times
Medium
LISTrack the best increasing sequence ending at each position
Medium
LCSIf characters match, advance both; otherwise try skipping one
Medium
String DPState usually represents positions in one or two strings
Medium
Interval DPTry every partition point and combine subinterval answers
Stock DPState = day + holding status + transaction state
Medium
String HashingRepresent strings using counts or hashable signatures
Medium
PalindromeCompare from both ends or expand around a center
Medium
String WindowExpand/shrink while maintaining character frequencies
Medium
String StackUse stack to remember unresolved characters
Medium
KMPReuse previously matched prefix information
TrieStore characters along paths for fast prefix operations
Medium
XORa ^ a = 0 and a ^ 0 = a
Bit TricksUse shifts, masks and bit operations instead of arithmetic loops
BitmaskUse each bit to represent whether an element/state is active
Medium
GCDUse Euclid's algorithm
Modular ArithmeticPerform operations while keeping values reduced modulo M
Medium
Fast PowerExponentiation by squaring in O(log n)
Medium
SieveMark multiples of each prime
Medium