0% found this document useful (0 votes)
3 views9 pages

Java DSA Roadmap

The document outlines a structured workflow for solving LeetCode problems and a comprehensive progression through four phases of algorithm study, focusing on data structures, algorithms, and competitive programming. Each phase includes specific milestones, recommended resources, and practice platforms to build problem-solving skills and prepare for FAANG interviews. The final phase emphasizes contest readiness and mastery of advanced topics, with clear benchmarks for achieving FAANG readiness.

Uploaded by

jayshravage9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views9 pages

Java DSA Roadmap

The document outlines a structured workflow for solving LeetCode problems and a comprehensive progression through four phases of algorithm study, focusing on data structures, algorithms, and competitive programming. Each phase includes specific milestones, recommended resources, and practice platforms to build problem-solving skills and prepare for FAANG interviews. The final phase emphasizes contest readiness and mastery of advanced topics, with clear benchmarks for achieving FAANG readiness.

Uploaded by

jayshravage9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

→ Advanced Algorithms → Contest Readiness

YOUR STRICT LEETCODE PROBLEM-SOLVING WORKFLOW — NEVER BREAK THIS

STEP 1 30-MIN SOLO Sit with the problem alone for 30 minutes. No hints, no searching, no asking. Think through
ATTEMPT brute force first, then optimise. Write down your approach before typing any code.

STEP 2 HINTS ONLY IF If genuinely stuck after the full 30 minutes — and only then — look at the hints section on
STUCK LeetCode. Not editorial. Not solutions. Hints only.

STEP 3 APPROACH / If hints are not enough, ask for the approach or pattern name only. Not the code. Example: 'use
PATTERN ONLY sliding window with a frequency map' is enough — now you go implement it yourself.

STEP 4 IMPLEMENT Close every reference. Write the full solution from scratch yourself. If you cannot, go back to
INDEPENDENTLY Step 3 and understand the pattern more deeply before trying again.

STEP 5 SIMILAR PROBLEMS Once solved, ask for 2-3 problems that use the exact same pattern. Solve those next to cement
the pattern. This is how pattern recognition is built.

COMPLETE BOOK PROGRESSION

# Book When Why

1 Data Structures and Algorithms in Phase 1 & 2 The most beginner-friendly DS&A; book written in Java. Covers arrays,
Java — Robert Lafore (primary start) linked lists, stacks, queues, trees, and sorting with clear Java code.
Start here — it builds intuition before theory.

2 Algorithms, 4th Edition Phase 2 & 3 Uses Java throughout. Covers sorting, searching, graphs, and strings
Sedgewick & Wayne (primary) with rigorous analysis. One of the best algorithms books written.
Companion site [Link] has free exercises.

3 Cracking the Coding Interview Phase 2 The standard FAANG interview prep book. 189 problems with detailed
Gayle Laakmann McDowell onward solutions. Covers all core topics plus system design basics and
(interview prep) behavioural interview guidance. Keep this open from Phase 2.

4 Elements of Programming Phase 3 & 4 Harder than CTCI. Problems are closer to actual FAANG interview
Interviews in Java — Aziz, Lee, (hard difficulty. Each chapter covers a topic with problems ranging from
Prakash problems) medium to very hard. Use this for Phase 3 and 4 depth.

5 Introduction to Algorithms (CLRS) Phase 3 & 4 The algorithms bible. Language-agnostic, mathematically rigorous. Do
Cormen, Leiserson, Rivest, Stein (theory not read cover-to-cover — use it as a deep reference when you need
reference) to understand why an algorithm works, not just how.

FREE WEBSITES & PRACTICE PLATFORMS (NO YOUTUBE)

Website When What to use it for

[Link] All phases Primary practice platform. Daily POTD, contests, and the largest problem bank. Use
(daily) the Java solution editor. Aim for a consistent solving streak.

[Link] All phases GFG POTD every day. Also excellent for topic-wise reading — each DS/algorithm
(daily article has theory, complexity analysis, and Java code. Supplement to books.
POTD)
[Link] Phase 2 Free problem lists and roadmaps organised by pattern (no video needed — use the
onward problem list only). NeetCode 150 and NeetCode 250 are the go-to curated sets for
FAANG prep.

[Link] Phase 2 & Companion site to Sedgewick's book. Free Java implementations of every algorithm
3 covered. Use to verify your own implementations and study clean Java DS code.

[Link] Phase 3 & Detailed algorithm explanations with pseudocode and complexity proofs. Covers
4 advanced topics: segment trees, BIT, string algorithms, graph theory. No YouTube
— pure text.

[Link]/problemset Phase 3 & 300 problems organised by topic. One of the best structured competitive
4 programming problem sets. Solve Graph Algorithms and Dynamic Programming
sections for FAANG depth.

[Link] Phase 3 & Weekly Div. 2 and Div. 3 contests. Solve in Java. Aim for A, B, C per contest. Past
4 problems organised by tag — use for targeted pattern practice.

[Link]/discuss All phases The LeetCode discussion section for each problem. After solving, read the
top-voted Java solution to learn cleaner approaches and alternative patterns.

THE 4 PHASES
PHASE
01 Foundations — Arrays, Strings & Sorting Weeks 1 – 4

Before any data structure, you need two things: the ability to analyse time and space complexity instinctively, and fluency with
arrays and strings — which are the substrate of 40% of all FAANG problems. Every pattern in later phases is built on what you
master here.

~8 – 10 hrs/week recommended (on top of Java language roadmap hours)

TOPICS & PATTERNS RESOURCES (in order)


■ Big O notation: O(1), O(log n), O(n), O(n log n), O(n^2) — time ■ Data Structures & Algorithms in Java (Lafore) — Ch. 1–7
AND space (primary)
■ How to analyse any loop, nested loop, or recursive call for ■ Cracking the Coding Interview (McDowell) — Ch. I-VII
complexity (intro), Ch. 1 Arrays & Strings
■ Arrays: traversal, reversal, rotation, prefix sums, difference ■ [Link] — each topic has a full theory article +
arrays Java examples
■ Two-pointer technique: opposite ends, same direction, ■ [Link] — Easy problems on Arrays and Strings to
fast-slow start
■ Sliding window: fixed size and variable size with a frequency ■ [Link] — 'Arrays & Hashing' and 'Two Pointers'
map sections of NeetCode 150
■ Strings: substring, palindrome check, anagram detection,
character frequency
■ Binary search: standard, on a rotated array, search on answer
(template)
■ Sorting algorithms — implement each from scratch in Java:
■ Bubble sort O(n^2), Insertion sort O(n^2), Selection sort
O(n^2)
■ Merge sort O(n log n) — divide and conquer, stable
■ Quick sort O(n log n) avg — partition, pivot selection
■ Counting sort, Radix sort — O(n) when applicable
■ Recursion: base case, recursive tree, call stack depth

PHASE MILESTONE

Phase 1 Problem Set — 50 Problems


MILESTONE — Phase 1 Exit Requirement

■ Solve 50 LeetCode problems: 30 Easy + 20 Medium — Arrays, Strings, Binary Search, Two Pointers, Sliding Window only
■ Implement from scratch in Java: BubbleSort, InsertionSort, MergeSort, QuickSort — all with test cases
■ For every problem solved: write the time complexity and space complexity as a comment at the top
■ LeetCode POTD streak: must have started — solve every day without breaking the chain
■ GFG POTD streak: same — started and unbroken
■ Push all implementations to GitHub: java-dsa-practice/phase-01-foundations/
PHASE
02 Core Data Structures Weeks 5 – 10

This phase covers the structures that appear in roughly 70% of all FAANG questions. The critical point is that you must both
implement each one from scratch AND know how to use Java's built-in equivalent fluently — because in interviews you use the
built-in, but you are asked how it works internally.

~10 – 12 hrs/week recommended (on top of Java language roadmap hours)

TOPICS & PATTERNS RESOURCES (in order)


■ Linked Lists: singly, doubly, circular — implement Node and all ■ Data Structures & Algorithms in Java (Lafore) — Ch. 5–12
operations (primary)
■ Linked list patterns: reverse (iterative + recursive), detect cycle ■ Algorithms 4th Ed. (Sedgewick) — Symbol Tables and BST
(Floyd's), find middle, merge two sorted chapters
■ Stacks: array-based and LinkedList-based — Java: use ■ Cracking the Coding Interview — Ch. 2 Linked Lists, Ch. 3
Deque<> as ArrayDeque<> Stacks & Queues, Ch. 4 Trees & Graphs
■ Stack patterns: valid parentheses, monotonic stack, next ■ [Link] — 'Linked List', 'Trees', 'Heap / Priority Queue'
greater element, min stack sections
■ Queues: circular queue, BFS pattern — Java: use Queue<> ■ [Link] — Java implementations to compare
as LinkedList<> or ArrayDeque<> with yours
■ HashMap / HashSet: frequency maps, two-sum pattern, group ■ [Link] — read Heap and BST theory articles
anagrams, longest consecutive
■ Binary Trees: TreeNode structure, all 4 traversals (inorder,
preorder, postorder, level-order)
■ Binary tree patterns: height, diameter, LCA, path sum, mirror,
serialize/deserialize
■ BST: insert, search, delete, validate BST, kth smallest, convert
to sorted array
■ Heaps / Priority Queue: min-heap and max-heap — Java:
PriorityQueue<> with Comparator
■ Heap patterns: top-K elements, K closest, merge K sorted lists,
median of data stream

PHASE MILESTONE

Phase 2 Problem Set — 75 More Problems + DS Library


MILESTONE — Phase 2 Exit Requirement | LinkedIn-Worthy

■ Implement from scratch: SinglyLinkedList, DoublyLinkedList, Stack, Queue, BinaryTree, BST, MinHeap — all in Java with
generics
■ Each implementation: full Javadoc comments, unit tests with JUnit 5, time complexity noted per method
■ Solve 75 more LeetCode problems: 20 Easy + 45 Medium + 10 Hard — focused on the topics above
■ Running totals: 125 problems solved, POTD streaks still unbroken
■ For each Medium/Hard: write a short comment explaining the key insight that makes the solution efficient
■ Pushed to GitHub: java-dsa-practice/ — phase-02-core-ds/ with clean READMEs and test coverage
PHASE Advanced Algorithms — Graphs, DP & Months 3 – 4
03
Backtracking

This is the phase that separates candidates who can solve Mediums from candidates who get FAANG offers. Dynamic
programming and graphs together account for roughly 50% of hard FAANG problems. There are no shortcuts — you need to
recognise these patterns on sight.

~12 – 15 hrs/week recommended (on top of Java language roadmap hours)

TOPICS & PATTERNS RESOURCES (in order)


■ Graph representation: adjacency list (HashMap>) vs matrix ■ Algorithms 4th Ed. (Sedgewick) — Graphs chapters
■ BFS: shortest path in unweighted graph, level-order traversal, (primary for graph theory)
0-1 BFS ■ Elements of Programming Interviews in Java (Aziz) — DP
■ DFS: connected components, cycle detection, topological sort and Graphs chapters
(Kahn's + DFS) ■ CLRS — use as reference for algorithm correctness proofs,
■ Weighted graphs: Dijkstra's algorithm (PriorityQueue + dist[]), not primary reading
Bellman-Ford ■ [Link] — complete NeetCode 150 during this phase
■ Union-Find / DSU: path compression + union by rank — cycle ■ [Link] — Graphs section: Dijkstra, DSU,
detection, MST topological sort
■ Graph patterns: number of islands, clone graph, course ■ [Link]/problemset — Graph Algorithms + Dynamic
schedule, word ladder Programming sections
■ DP foundations: memoisation vs tabulation, state definition, ■ [Link] — Hard problems on DP and Graphs
transition formula
■ 1D DP: climb stairs, house robber, coin change, decode ways,
word break
■ 2D DP: unique paths, minimum path sum, edit distance,
longest common subsequence
■ Knapsack: 0/1 knapsack, unbounded knapsack, partition equal
subset sum
■ Sequence DP: LIS, LCS, palindromic substrings, palindrome
partitioning
■ Backtracking: permutations, combinations, subsets, N-queens,
Sudoku solver
■ Greedy: interval scheduling, merge intervals, jump game, task
scheduler
■ Tries: TrieNode structure, insert, search, startsWith, word
search II

PHASE MILESTONE

NeetCode 150 Complete + 100 More Problems


MILESTONE — Phase 3 Exit Requirement | FAANG Benchmark

■ Complete all 150 problems on NeetCode 150 — every single one, no skipping
■ Solve 100 additional problems: 30 Medium + 70 Hard — Graphs and DP focus
■ Running total: 325+ problems solved across all phases
■ For every DP problem: write the state definition, transition, and base case as comments before code
■ Implement from scratch: Graph (adjacency list, BFS, DFS, Dijkstra), DSU (path compression + rank), Trie
■ Start Codeforces participation: attempt Div. 3 contests weekly, target solving A + B + C
■ POTD streaks: both LeetCode and GFG — still unbroken from Phase 1
PHASE
04 Contest Readiness & FAANG Mastery Months 5 – 6+

The target is clear: solve LeetCode contest problems Q1 and Q2 in under 30 minutes, attempt Q3 within 45. This requires not just
knowing patterns but pattern recognition under time pressure — which only comes from doing timed contests repeatedly.

~15 – 18 hrs/week recommended (on top of Java language roadmap hours)

TOPICS & PATTERNS RESOURCES (in order)


■ Segment trees: range sum query, range minimum query, point ■ Elements of Programming Interviews in Java (Aziz) — full
update, range update cover-to-cover
■ Binary Indexed Tree (Fenwick Tree): prefix sums, range ■ [Link] — advanced topics: segment tree, BIT,
updates in O(log n) KMP, string hashing
■ Advanced DP: bitmask DP (TSP, assignment), interval DP ■ [Link]/problemset — Range Queries, Tree Algorithms,
(matrix chain), digit DP Math sections
■ String algorithms: KMP pattern matching, Z-algorithm, ■ [Link] — weekly Div. 2 contests; upsolve after
Rabin-Karp rolling hash every contest
■ Advanced graph: SCC (Kosaraju), bridges & articulation points ■ [Link]/contest — LeetCode Weekly + Biweekly
(Tarjan), Euler path contests every week
■ Math for DSA: modular arithmetic, fast exponentiation, sieve of ■ CLRS — segment trees, string matching chapters for theory
Eratosthenes
■ Bit manipulation: XOR tricks, count set bits, find
missing/duplicate, bitmask subsets
■ Monotonic structures: monotonic stack (advanced), monotonic
deque (sliding window max)
■ Contest strategy: time management, reading all problems first,
partial scoring

PHASE MILESTONE

FAANG Readiness Benchmark — Complete All 4


CAPSTONE — FAANG READINESS LEVEL

■ BENCHMARK 1: LeetCode Top 150 (Interview Crash Course) — all 150 problems solved
■ BENCHMARK 2: LeetCode contest performance — consistently solving Q1 + Q2 within 30 min, reaching Q3
■ BENCHMARK 3: Codeforces rating 1400+ (Specialist) — achieved through regular contest participation
■ BENCHMARK 4: 500+ total problems solved across all platforms with complexity analysis on every solution
■ MOCK INTERVIEWS: Complete 10 timed mock interviews (45 min each) — 2 problems per session, no help
■ All DS implementations pushed to github: java-dsa-practice/ — clean, tested, documented — pin this repo
DAILY POTD SYSTEM — NON-NEGOTIABLE

Every single day — no exceptions: Why this matters:


■ LeetCode Problem of the Day (POTD) ■ Consistency beats intensity — 2 problems daily for 6
■ GFG Problem of the Day (POTD) months = 360 problems
■ POTDs cover all difficulties — they expose you to topics
Rules:
before you formally study them
■ Attempt before looking at any hint — always
■ Streaks build discipline — this is the same discipline
■ If you cannot solve it that day — note the pattern, revisit it FAANG interviews test
tomorrow
Tracking:
■ Track your streak on both platforms — streaks create
accountability ■ Keep a DSA journal: date, problem name, pattern used,
time taken, key insight
■ After solving: read top-voted solution for a cleaner approach
■ Review the journal weekly — spot your weak patterns
■ If a POTD is too hard for your current phase — skip it but
note the topic ■ Monthly: count problems by topic — if any topic has less
than 10 problems, focus there

LEETCODE CONTEST STRATEGY — HOW TO REACH 30-45 MIN

The goal of LeetCode contests is not just to solve problems — it is to train your brain to immediately recognise which
pattern a problem needs. This recognition is exactly what FAANG interviews test in the first 5 minutes.

Stage What to do

BEFORE THE Do a 15-min warm-up: solve one Easy problem you have seen before to get into problem-solving mode.
CONTEST Have Java editor open and your standard template ready (imports, Scanner/BufferedReader, etc.).

FIRST 2 MINUTES Read ALL four problems quickly. Do not start coding. Categorise each one: which topic is it? Arrays?
DP? Graph? This prevents you from spending 30 min on Q2 when Q3 was easier.

Q1 TARGET: < 5 MIN Q1 is always straightforward. If it takes more than 5 minutes, you are overthinking it. Brute force is fine for
Q1 — get the points and move on immediately.

Q2 TARGET: < 20 MIN Q2 is a Medium. If you know the pattern, you should solve this in 10-15 min. If you are stuck at 15 min:
write a brute force first to get partial credit, then optimise.

Q3 TARGET: ATTEMPT Q3 is a hard Medium or easy Hard. Identify the pattern, code the skeleton, handle edge cases. Partial
IN REMAINING TIME credit (wrong answer but correct approach) is better than not attempting.

AFTER THE CONTEST Upsolve every problem you did not finish or got wrong. Read editorial for any problem you found hard.
This upsolve session is more valuable than the contest itself — do not skip it.

WEEKLY CADENCE LeetCode Weekly Contest: Sunday. LeetCode Biweekly: every other Saturday. Codeforces Div. 2 or Div.
3: check schedule at [Link]. Aim to participate in at least 2 contests per week.

MASTER TOPIC CHECKLIST — TRACK YOUR PROGRESS

Tick each topic off only when you have: (a) understood the theory, (b) implemented the data structure or algorithm from scratch in
Java, and (c) solved at least 5 LeetCode problems using that pattern.
Phase 1 — Foundations [] String manipulation patterns
[] Big O analysis (time & space) [] Recursion + call stack analysis
[] Arrays — prefix sum, difference array [] Sorting — Bubble, Insertion, Selection
[] Two pointers [] Merge sort
[] Sliding window (fixed + variable) [] Quick sort
[] Binary search (standard + rotated + on answer)

Phase 2 — Core Data Structures [] HashMap / HashSet patterns


[] Linked list — singly, doubly (from scratch) [] Binary tree traversals (all 4)
[] Linked list patterns (reverse, cycle, merge) [] Binary tree patterns (LCA, diameter, path sum)
[] Stack (from scratch + ArrayDeque) [] BST (insert, delete, validate)
[] Monotonic stack [] Min-heap / Max-heap (from scratch + PriorityQueue)
[] Queue + BFS (from scratch + LinkedList) [] Top-K heap patterns

Phase 3 — Advanced Algorithms [] 2D Dynamic programming


[] Graph: BFS, DFS [] 0/1 Knapsack
[] Graph: topological sort [] LIS / LCS
[] Graph: Dijkstra's algorithm [] Backtracking
[] Graph: Bellman-Ford [] Greedy + interval problems
[] Union-Find / DSU [] Trie (from scratch)
[] 1D Dynamic programming

Phase 4 — Advanced [] SCC — Kosaraju's algorithm


[] Segment tree (range sum + range min) [] Bridges + articulation points
[] Binary Indexed Tree / Fenwick tree [] Modular arithmetic + fast exponentiation
[] Bitmask DP [] Bit manipulation patterns
[] Interval DP [] Sliding window maximum (monotonic deque)
[] KMP string matching

CUMULATIVE PROBLEM COUNT TARGETS

Checkpoint Easy Medium Hard Total Focus

End of Phase 1 50 25 0 75 LeetCode Easy/Medium, Arrays, Strings, Binary Search

End of Phase 2 125 50 0 175 Add Linked Lists, Trees, Heaps problems

End of Phase 3 175 100 50 325 NeetCode 150 complete, Graphs, DP, Backtracking

End of Phase 4 200 200 100 500+ LeetCode Top 150 + contests + all advanced topics

WEEKLY HOURS ESTIMATE (DSA only — on top of Java language hours)

Phase Timeline Hrs/w Daily breakdown


k

Phase 1 — Foundations Weeks 1–4 8–10 POTD x2 daily (1 hr) + Lafore reading (1 hr) + problem solving (1 hr) per
day

Phase 2 — Core DS Weeks 5–10 10–12 POTD x2 + DS implementation + 2-3 topic problems per day
Phase 3 — Advanced Months 3–4 12–15 POTD x2 + NeetCode 150 + contest weekly + CSES problems
Algorithms

Phase 4 — Contest Readiness Months 15–18 POTD x2 + 2 contests/week + upsolving + mock interviews
5–6+

Combined total with Java language roadmap: expect 20-30 hrs/week total across both. The POTD routine (2 problems/day) accounts
for roughly 1-1.5 hrs daily and runs through all phases.

Java DSA Roadmap | Jay's Learning Plan | Lafore → Sedgewick → CTCI → EPI Java → 500+ problems → Contest ready.

You might also like