30-Day DSA Learning Roadmap with Java
Generated on: 2025-07-26
1. Topic-wise Cheat Sheet Summary
Arrays, Strings, ArrayList:
- Array traversal, reversal, prefix sum, sliding window basics
- String immutability, char[] vs StringBuilder, Java string functions
- ArrayList: add(), remove(), contains(), time complexity
HashMap / HashSet:
- put(), get(), containsKey(), keySet(), entrySet()
- Use cases: frequency count, duplicates, grouping
Stack / Queue:
- Java Stack & Queue classes
- Monotonic stack patterns
Linked List:
- Node class, insert/delete at head/tail
- Cycle detection (Floyd's), reverse list
Trees / BST:
- TreeNode class, inorder, preorder, postorder
- Height, diameter, balance check
Graphs:
- Adjacency list, DFS/BFS templates
- Topo sort, Dijkstra
Dynamic Programming:
- Memoization, tabulation
- 0/1 Knapsack, LIS, LCS
Sliding Window / Two Pointers:
- Fixed vs variable window
- Applications: max sum, longest substring, etc.
2. 30-Day Roadmap (Daily Goals)
Week 1:
Day 1-2: Arrays (traverse, reverse, sum, max)
Day 3-4: Strings (anagram, palindrome, compress)
Day 5-6: ArrayList & pattern problems
Day 7: Practice 5 Easy problems
Week 2:
Day 8: Recursion (factorial, subsets)
Day 9: Backtracking (N-Queens / Rat in maze)
Day 10-11: Sorting (merge, quick)
Day 12-13: Binary Search (1D + rotated)
Day 14: Practice 5 Medium problems
Week 3:
Day 15-16: HashMap, HashSet problems
Day 17-18: Stack/Queue basics + monotonic stack
Day 19-20: Linked List (reverse, detect cycle)
Day 21: Practice 2 Hard problems
Week 4:
Day 22-23: Trees + traversals
Day 24: BST (validate, LCA)
Day 25-26: Graph BFS/DFS, topological sort
Day 27: Heap + Priority Queue
Day 28-29: Intro to DP (Fibonacci, LCS)
Day 30: Full revision & mock test
3. 100+ DSA Problem List
(Only sample problems shown - full list in attached supplement PDF)
Arrays:
- Two Sum (LC Easy)
- Best Time to Buy Stock (LC Easy)
- Rotate Array (LC Medium)
Strings:
- Valid Anagram (LC Easy)
- Longest Substring Without Repeating (LC Medium)
HashMap / HashSet:
- Group Anagrams (LC Medium)
- Isomorphic Strings (LC Easy)
Linked List:
- Reverse LL (LC Easy)
- Merge Two Sorted LL (LC Easy)
Stack / Queue:
- Valid Parentheses (LC Easy)
- Daily Temperatures (LC Medium)
Trees / Graph:
- Binary Tree Level Order Traversal
- Number of Islands
Dynamic Programming:
- Climbing Stairs
- Longest Common Subsequence
Sliding Window:
- Maximum Sum Subarray (fixed size)
- Longest Subarray with K distinct
4. Java Code Templates
Array Traversal:
for (int i = 0; i < [Link]; i++) { ... }
HashMap:
Map<Integer, Integer> map = new HashMap<>();
[Link](key, value); [Link](key);
Stack:
Stack<Integer> stack = new Stack<>();
[Link](x); [Link]();
Linked List Node:
class Node {
int data;
Node next;
Node(int val) { data = val; }
}
Binary Tree Traversal (Inorder):
void inorder(TreeNode root) {
if (root == null) return;
inorder([Link]);
[Link]([Link]);
inorder([Link]);
}
Graph BFS:
Queue<Integer> q = new LinkedList<>();
boolean[] visited = new boolean[n];
[Link](start); visited[start] = true;
while (![Link]()) { ... }
DP (Memoization):
int dp(int n, int[] memo) {
if (n <= 1) return n;
if (memo[n] != -1) return memo[n];
return memo[n] = dp(n-1, memo) + dp(n-2, memo);
}