8-Week DSA & Competitive Programming Mastery
Plan
Top tech companies (Google, Microsoft, Amazon, etc.) strongly emphasize data structures & algorithms
(DSA) in interviews 1 . This two-month daily schedule alternates focused learning (40–60% of time on DSA
concepts) with contest practice (Codeforces/CodeChef) and guided upsolving. It also includes key math
concepts – number theory, combinatorics, modular arithmetic – that often underpin CP problems. Use
structured resources (e.g. GeeksforGeeks CP Handbook 2 , LeetCode curated lists, algorithm video
lectures) and track progress by weekly goals. By the end of 8 weeks, you’ll build intuition for solving tough
problems under time pressure.
Week 1: Foundations – Arrays, Strings, Sorting, Search
Goal: Master basic data structures (arrays, strings, hash tables) and simple algorithms (sorting, binary
search, recursion). These are the building blocks of all problems 3 .
• Day 1: Review arrays/strings in C++ and Python (indexing, iteration). Solve 5–10 easy problems (e.g.
“Two Sum”, “Reverse String”) on LeetCode or GfG. Focus on writing bug-free code in both languages
to strengthen syntax.
• Day 2: Study sorting algorithms (e.g. quicksort, mergesort) and implement one in C++. Then solve 3–
5 problems using sorting (e.g. “Sort Colors”, “Merge Intervals”).
• Day 3: Learn binary search technique. Practice classic problems (“Binary Search in Rotated Array”,
“Find Minimum in Rotated Sorted Array”). Use Codeforces EDU or LeetCode tutorials on binary
search to guide you.
• Day 4: Cover hash tables and maps. Solve problems like counting frequencies or using a map/set
(e.g. “Two Sum with Hashmap”, “Group Anagrams”). Implement C++ STL unordered_map / set
and Python dict / set .
• Day 5: Study recursion fundamentals (tree traversal, backtracking basics). Solve 3 easy recursive
problems (Fibonacci, factorial, or “Print all subsets of a set”). Reinforce with a short online lecture if
needed.
• Day 6: Contest Practice: Do one short contest (e.g. Codeforces Div3 or CodeChef Starter). Treat it as
a real contest (timed, no solution checking). Attempt at least 3 problems, then stop.
• Day 7: Upsolve: Review the contest you just did. For every unsolved problem, read the editorial and
re-implement the solution. This guided upsolving cements understanding. End the week by writing
1–2 summary notes on any new tricks learned.
Resources: GeeksforGeeks SDE Sheet (Arrays/Strings section), LeetCode “Top Interview Questions” (easy
list) 4 , Codeforces EDU (sorting/search module).
Expected Outcome: Comfortably solve basic array/string problems in C++ and Python. Understand time/
space trade-offs of simple algorithms (e.g. $O(n\log n)$ sorting vs. $O(n)$ linear scans). Gain first
1
experience in contest format and upsolving. You’ll have laid the groundwork (“data structures are building
blocks” 3 ).
Week 2: Fundamental Algorithms – Searching, Greedy, Bitwise
Goal: Strengthen algorithmic techniques: binary search (on answers), two-pointers, greedy approaches, and
bit manipulation. These logical patterns frequently appear in CP.
• Day 1: Deepen binary search skills: solve “binary search on answer” problems (e.g. “Split Array
Largest Sum”). Study Codeforces binary search tutorial if needed.
• Day 2: Two-pointer and sliding-window technique: solve string/array problems like “Container With
Most Water”, “Longest Substring Without Repeating Characters”. This builds intuition on using two
indices to scan linear structures.
• Day 3: Greedy algorithms: cover classic greedy topics (activity selection, interval scheduling). Solve
problems like “Assign Cookies” (LeetCode) or “Jump Game”. Compare greedy vs. DP strategies.
• Day 4: Bit manipulation: practice with problems involving bits (e.g. “Number of 1 Bits”, “Single
Number”). Study common tricks (XOR, bit shifts). Use any good tutorial or GfG for bitwise practice.
• Day 5: Hashing and sets review: solve a few medium problems combining hash + above techniques
(e.g. “Longest Consecutive Sequence” using a set).
• Day 6: Contest Practice: Attempt another CP contest (e.g. CF Div3 or CodeChef Cook-Off). Focus on
applying the new techniques.
• Day 7: Upsolve + Review: Analyze mistakes. Take note of any new insights (e.g. a clever greedy
insight, a tricky binary search boundary). Ensure to solve at least 1 previously unseen easy problem
(from LeetCode Easy) as additional practice.
Resources: Codeforces problem sets for two-pointers/greedy, GeeksforGeeks tutorials on bit manipulation.
(For bit tricks, see GfG’s Bitwise Algorithms section 5 ). Practice problems on Hackerrank or CodeChef
small contests 6 .
Expected Outcome: Ability to apply binary search, two-pointer, and greedy strategies fluently on medium
problems. You’ll recognize when to use each pattern. Your contest-solving speed and accuracy should begin
to improve noticeably.
Week 3: Recursion & Divide-and-Conquer, Intro to Graphs/Trees
Goal: Use recursion and divide-&-conquer on classic problems and start with basic graph/tree traversal
(BFS/DFS).
• Day 1: Divide-and-Conquer: solve “Count Inversions” using merge-sort technique or “Search in a
Binary Search Tree” recursively. Reinforce understanding of recursion depth and memoization (if
needed).
• Day 2: Trees – basics: implement DFS and BFS on binary trees/graphs. Solve simple tree problems
(e.g. tree depth, check balanced tree). If unfamiliar, watch a video (e.g. Abdul Bari’s tree traversal).
• Day 3: Graph traversal: represent a simple graph and run BFS/DFS. Solve problems like “Number of
Islands” (grid BFS). Understand visited markers to avoid cycles.
• Day 4: Connected components / cycles: solve an easy graph problem (e.g. “Graph Valid Tree”, or
union-find basics). Learn Union-Find (DSU) by coding a simple union-by-rank.
2
• Day 5: Basic dynamic programming (introduction): cover 1D DP like Fibonacci, climbing stairs,
knapsack. Solve an easy DP problem (“Climbing Stairs”, “Coin Change 2”). (Fundamentals prepare for
later DP work.)
• Day 6: Contest Practice: Do a contest focusing on BFS/DFS problems (perhaps pick one with explicit
graph problems). Try to solve at least 3 of 4 problems, even if they seem DP or graph.
• Day 7: Upsolve: Work through editorial for unsolved contest problems. Review any DP or graph
solution you skipped. Finish by coding solutions to 1–2 upsolved problems from scratch.
Resources: GeeksforGeeks or Coursera lectures on BFS/DFS and basic DP. GfG CP Handbook has a guide to
DFS/BFS 2 . LeetCode Explore for Trees/Graphs.
Expected Outcome: Comfortable with recursion for divide-&-conquer and basic tree/graph traversals. You’ll
be able to solve easy-medium graph problems and use recursion confidently. Your upsolving practice starts
making contest concepts stick.
Week 4: Advanced Data Structures (Heaps, Trees, DSU)
Goal: Learn more data structures – priority queues (heaps), balanced trees, and Disjoint Set Union. These
enable solving tougher problems efficiently.
• Day 1: Heaps & Priority Queue: study max-heap/min-heap. Solve problems using heaps (e.g. “Merge
k Sorted Lists”, “Top K Frequent Elements”). In C++, practice using priority_queue ; in Python, use
heapq .
• Day 2: Binary Search Trees: practice tree problems like “Validate BST” or “Convert Sorted Array to
BST”. Understand in-order traversal and recursion on trees.
• Day 3: Segment Trees / Fenwick Trees (BIT) – concepts only: watch a tutorial on segment trees and
Fenwick trees. Solve a basic range-sum query problem if possible. (Even if not coding fully,
understand when they apply.)
• Day 4: Disjoint Set (Union-Find): implement DSU data structure with union-by-rank and path
compression. Solve a connectivity problem (e.g. “Number of Connected Components in an
Undirected Graph”).
• Day 5: Advanced Trees: Tree DP or graph short paths. If comfortable, attempt an easy graph path
problem (e.g. single-source shortest path in unweighted graph).
• Day 6: Contest Practice: Take a contest that includes at least one DSU or heap problem (e.g.
Codeforces educational round with MST/graph). Solve what you can within time.
• Day 7: Upsolve: Carefully read editorials for unsolved problems. Re-implement any new data-
structure logic you encountered. Do 1 practice problem involving your weak spot (DSU/heaps).
Resources: MIT’s Advanced Data Structures lectures 7 , GeeksforGeeks DSU guide, and C++ STL docs on
priority_queue . The GfG “Advanced Data Structures (MIT)” course covers these concepts 7 .
Expected Outcome: Knowledge of when to use heaps, trees, and union-find. You’ll have solved several non-
trivial problems using these structures. Your code leverages C++ STL (or Python) effectively for efficiency.
3
Week 5: Greedy/Dynamic Programming (Intermediate DP)
Goal: Develop intuition for DP and more greedy problems. Master common DP patterns (0/1 knapsack,
subsequences) as they are essential for interviews.
• Day 1: Greedy Review: Solve greedy challenges (e.g. activity selection, fractional knapsack,
scheduling problems). Ensure you can justify why greedy works for these.
• Day 2: DP 1D: Solve classic 1D DP problems: “Longest Increasing Subsequence”, “Partition Equal
Subset Sum”. Practice bottom-up and memo approaches.
• Day 3: DP 2D: Tackle DP on grids/strings: “Edit Distance (Levenshtein)”, “Word Break”. Work through
recurrence relations manually first.
• Day 4: Combinatorial DP: Use math in DP: “Coin Change (min coins)”, “Pascal’s Triangle (nCr)”.
Observe overlap with combinatorics (pigeonhole, binomial coefficients).
• Day 5: Mixed Problems: Solve one medium that combines greedy + DP (e.g. “Jump Game II” or
scheduling with weighted jobs).
• Day 6: Contest Practice: Codeforces Div2 (medium rating) or CodeChef Long Challenge: solve at
least 2 DP problems, even if large. Use any remaining time on easier ones.
• Day 7: Upsolve: Read editorials, and re-code the hardest problem from today’s contest. Reflect on
any DP patterns you still find tricky and revise those (e.g. weighted interval scheduling).
Resources: Online courses (Princeton/Stanford algorithms 8 ) cover DP fundamentals. GfG DP tutorials, as
well as free YouTube series (e.g. Aditya Verma – Dynamic Programming). LeetCode Blind 75 DP section is ideal
(curated by top coders) 4 .
Expected Outcome: Solid grasp of several DP paradigms. You’ll be able to formulate and code DP solutions
for medium-level problems and know when greedy fails. Contest performance on DP problems will improve,
and many solution patterns will be internalized.
Week 6: Number Theory and Combinatorics
Goal: Cover key math topics that frequently appear in contests: modular arithmetic, prime numbers, GCD,
combinatorics (counting, permutations). Mastering these is “crucial for algorithmic challenges” 9 .
• Day 1: Number Theory Basics: Study prime sieves (Sieve of Eratosthenes) and primality tests.
Implement a fast prime sieve for $n\approx10^6$. Solve a simple problem like “Count Primes <= n”.
• Day 2: GCD/LCM: Implement Euclid’s GCD (and LCM). Solve problems like “Super Egg
Drop” (DP+Math) or “LCM Pair Count”. Learn modular inverse by Extended Euclid or Fermat’s Little
Theorem.
• Day 3: Modular Arithmetic: Practice mod arithmetic operations. Solve modular problems (e.g.
“Power Mod: compute $x^n \bmod M$ fast”). GeeksforGeeks notes that modular arithmetic “wraps”
numbers to avoid overflow 10 . Use CP-algorithms binary exponentiation for reference.
• Day 4: Combinatorics: Learn counting rules (nCr, nPr). Solve “N choose K modulo $10^9+7$” or
“Ballot theorem” problems. GfG defines combinatorics as “counting and arranging discrete
objects” 11 – practice on simple probability/counting puzzles.
• Day 5: Advanced Math Tricks: Study pigeonhole principle and inclusion-exclusion (simple examples:
derangements, simple probability). Solve a problem using inclusion-exclusion (e.g. “Number of ways
to arrange with restrictions”).
4
• Day 6: Mixed Problems: Solve 2–3 contest problems heavy on math (e.g. “Divisors and Sieve”,
“Modular Summations”, “Combinatorial Identities”).
• Day 7: Review & Contest: Briefly review everything. Then do a short math-intensive contest (even a
custom one: e.g. pick 5 LeetCode/CF problems on number theory). Upsolve any mistakes.
Resources: GeeksforGeeks Number Theory for CP and Combinatorics for CP articles 12 11 . Also see GfG’s
math CP course (emphasizing that math is essential) 9 . The USACO Guide on modular arithmetic and CP-
algorithms (binary exponentiation) will be helpful.
Expected Outcome: You’ll be comfortable with primes, GCD, modular arithmetic, and combinatorial
formulas. Many CP problems require these skills (e.g. counting paths mod $10^9+7$). Mastery here gives
you powerful tools – remember, “numbers wrap around after modulus” to keep arithmetic tractable 10 .
Week 7: Intensive Contest Training & Weak-Spot Fixes
Goal: Apply all learned skills in a high-intensity practice phase. Focus on contest speed, problem selection,
and tightening any remaining weak areas.
• Day 1: Pick 5–6 unsolved problems from past Codeforces Div.2 A–C (varying topics) and solve them at
leisure. Emulate contest conditions (timed).
• Day 2: Do a virtual contest: use Codeforces virtual contest feature or join a live contest. Aim for at
least 3 problems. Resist looking at solutions.
• Day 3: Upsolve yesterday’s contest thoroughly. For each problem you skipped or solved incorrectly,
write out the correct idea and re-code it.
• Day 4: Practice 2 LeetCode medium problems (your choice). Time yourself (~30 min each). This
simulates interview problem solving outside of formal contests.
• Day 5: Review advanced topics you struggled with (identify from last contests): e.g. if DP was tough,
re-solve a missed DP problem; if math was slow, re-derive a formula.
• Day 6: Participate in another CP contest (CodeChef Long or CF Round). Go all-out to solve as many as
possible.
• Day 7: Final upsolving and review. Reflect on progress. Ensure you’ve touched on every topic at least
once by now. If any core topic feels shaky, schedule a quick review for Week 8.
Resources: Mixed - keep using Codeforces, CodeChef, and LeetCode. Consult editorials and blogs (CF blog
posts) for tricky problems. No new material: reinforce speed and pattern recognition.
Expected Outcome: Your problem-solving speed and accuracy should peak. You will have practiced the
contest cadence (set of problems, time management, quick debugging). Weaknesses should be mostly
addressed, making you interview-ready.
Week 8: Final Review and Mock Interviews
Goal: Consolidate learning and simulate real interviews. By now “data structures and algorithms are second
nature” 3 . Use this week to polish and evaluate readiness.
• Day 1: Do 2 full mock interviews: pick 2 LeetCode “Medium/Hard” problems and solve them from
scratch (30–45 min each) without notes. Focus on clear thought process and optimizing.
5
• Day 2: Review all weekly notes. Quickly revisit any remaining weak areas (e.g. segment tree code,
tricky DP).
• Day 3: Solve 3–4 easy problems for confidence (e.g. Codeforces problems rated < 1300). Ensure any
silly mistakes are ironed out.
• Day 4: Do a full practice contest (similar to an onsite test): 3 problems in 1 hour, from any platform.
• Day 5: Guided Upsolve: For yesterday’s contest/test, do a thorough editorial walkthrough of each
solution. If you had access, compare your solutions for time/memory.
• Day 6: Review C++ vs Python notes (see below). Ensure your default language choice is set. Solve 1
problem in each language for refresher.
• Day 7: Final contest or mock interview: pick your toughest unsolved problem or contest. Push
yourself to simulate interview pressure. End by summarizing what you learned overall.
Resources: This week is about practice. Use accumulated bookmarks: LeetCode interview problem sets
(Blind 75) 4 , GfG “Daily DSA” problem series, and previous contest archives. Optionally review a high-
quality course lecture (e.g. MIT Algorithms 7 ) on a topic you feel uncertain about.
Expected Outcome: You’ve reviewed and practiced intensively. You should now solve interview-style
problems confidently and efficiently. All core topics (arrays, trees, graphs, DP, math) have been practiced
under timed conditions. You’re in strong shape to crack coding interviews and internships.
C++ vs Python for CP/DSA
• Performance: C++ is compiled and fast; Python is interpreted and slower. GeeksforGeeks notes that
today C++’s “efficiency, speed, and memory” make it widely popular for competitive coding 13 . In
fact, ~94% of high-rated Codeforces coders use C++, whereas only ~3% use Python 14 , underscoring
its speed edge. Python incurs runtime overhead (dynamic typing, interpreter) that can make
solutions 3–10× slower 15 . For time-critical CP problems, C++ is usually safer for avoiding TLE.
• Libraries & Ease of Coding: C++ STL provides many built-in data structures (vectors, maps, sets,
priority queues, etc.) which speeds up coding 16 . Python has concise syntax and powerful built-ins
(lists, dicts, etc.), so code is shorter and easier to prototype 15 . As one source puts it, “Python code is
generally 5–10 times shorter than the equivalent C++ code” 15 . This can boost productivity for
small/medium tasks.
• Contest Suitability: In contests, speed is paramount. C++’s low-level control and STL usage make it
ideal 16 . Most contest problems assume C++ efficiency. Python can solve many problems too (and is
sometimes preferred for big-integer arithmetic or quick scripting), but for large inputs C++ reduces
risk of timeouts. Ultimately, many experts recommend using C++ for CP due to its performance and
libraries 16 13 . Python remains useful (and many grandmasters do use it), but beginners aiming
for top internships are usually advised to master C++ for DSA 16 15 .
In summary: Use C++ as your primary CP language for speed and STL convenience 16 13 . Keep Python as
a supplementary tool when rapid coding or high-level libraries are needed, but beware of its slower runtime
15 .
Sources: This plan is based on competitive programming best practices and resources. GeeksforGeeks
highlights DSA importance 1 3 and math essentials 9 ; the GfG CP Handbook provides a full roadmap
6
2 . LeetCode’s curated problem lists (e.g. Blind 75 4 ) and Codeforces/Chef contest problems are
recommended practice 6 . The C++/Python comparison draws from industry community observations 13
15 . All these guided our schedule and resource suggestions.
1 3 7 8 10 Best Data Structures and Algorithms(DSA) Courses [2025] | GeeksforGeeks
https://www.geeksforgeeks.org/best-data-structures-and-algorithms-courses/
2 5 9 Top 10 Algorithms and Data Structures for Competitive Programming | GeeksforGeeks
https://www.geeksforgeeks.org/top-algorithms-and-data-structures-for-competitive-programming/
4 Top 75 LeetCode Questions for 2022 | Mohamed Wael Bishr posted on the topic | LinkedIn
https://www.linkedin.com/posts/mohamed-wael-bishr_new-year-gift-curated-list-of-top-75-leetcode-
activity-7190646474844610560-Lj9w
6 14 C++, Java or Python: which language is better for Competitive Coding? | by Rahul agarwal |
15
Student Technical Community — VIT Vellore | Medium
https://medium.com/student-technical-community-vit-vellore/c-java-or-python-which-language-is-better-for-competitive-
coding-4f48063b1a73
10 Modular Arithmetic · USACO Guide
https://usaco.guide/gold/modular
11 Basics of Combinatorics for Competitive Programming | GeeksforGeeks
https://www.geeksforgeeks.org/basics-of-combinatorics-for-competitive-programming/
12 Number Theory for DSA & Competitive Programming | GeeksforGeeks
https://www.geeksforgeeks.org/number-theory-competitive-programming/
13 C++ vs Java vs Python | GeeksforGeeks
https://www.geeksforgeeks.org/c-vs-java-vs-python/
16 “Hello Wolrd” in many popular programming languages | by Ducanh03 | Medium
https://medium.com/@namobilegame/hello-wolrd-in-many-popular-programming-languages-a451af4b2255