Last-minute revision, formula sheets, and code templates β all in one place.
Two pointers, sliding window, prefix sums β all patterns with time complexity.
Insert, delete, reverse, detect cycle β with visual diagrams and code templates.
Inorder, preorder, postorder, BFS β recursive and iterative code in Python and C++.
How to identify DP problems + 8 core patterns with examples and state transitions.
Linear regression, gradient descent, loss functions, regularization β all key formulas.
CSS flexbox, grid, common JS patterns, fetch API β all on one printable sheet.
Copy-paste these templates into your editor during practice.
# Standard binary search def binary_search(arr, target): left, right = 0, len(arr) - 1 while left <= right: mid = left + (right - left) // 2 if arr[mid] == target: return mid elif arr[mid] < target: left = mid + 1 else: right = mid - 1 return -1
# Variable size sliding window def sliding_window(arr): left = 0 result = 0 window = {} # or a running sum for right in range(len(arr)): # Expand window window[arr[right]] = window.get(arr[right], 0) + 1 # Shrink window (condition) while invalid(window): window[arr[left]] -= 1 left += 1 result = max(result, right - left + 1) return result
from collections import deque def bfs(graph, start): visited = {start} queue = deque([start]) while queue: node = queue.popleft() process(node) # do something for neighbor in graph[node]: if neighbor not in visited: visited.add(neighbor) queue.append(neighbor)
# Bottom-up DP (Climbing Stairs) def climb_stairs(n): if n <= 2: return n prev2, prev1 = 1, 2 for i in range(3, n + 1): curr = prev1 + prev2 prev2 = prev1 prev1 = curr return prev1 # O(n) time, O(1) space β
These notes work best when you combine them with topic-wise practice, interview preparation, and roadmap-based study sessions.
Use the DSA sheet to apply the same concepts you review in these cheat sheets.
Bridge quick notes with coding rounds, HR answers, and system design preparation.
Use the roadmaps to know when to revise arrays, trees, graphs, and dynamic programming.