Competitive Coding

Unit 7: Capstone โ€” Contest Strategy & Career Launchpad

Synthesize everything from Units 1โ€“6, build a killer portfolio, master contest strategy, ace coding interviews, and launch your competitive programming career.

โฑ๏ธ Time to Complete: 8โ€“10 hours  |  ๐Ÿ’ฐ Earning Potential: โ‚น10,000โ€“โ‚น50,000/month  |  ๐Ÿ“ 30 MCQs (Bloom's Mapped)

๐Ÿ’ผ Jobs this unlocks: SDE-1 (โ‚น8โ€“25 LPA)  |  Problem Setter (โ‚น15Kโ€“โ‚น50K/month freelance)  |  Competitive Programming Coach (โ‚น20Kโ€“โ‚น80K/month)

Section A

Opening Hook โ€” From Zero Rating to โ‚น18 LPA at Razorpay

๐Ÿ† How Arjun from Jaipur Went from Codeforces 0 โ†’ Expert (1600+) in 6 Months

Arjun Meena was a 2nd-year BCA student at a tier-3 college in Jaipur. He had never written a competitive programming solution. His first Codeforces contest? He solved zero problems and his rating was 0. He felt humiliated watching others solve problems in minutes that he couldn't crack in 2 hours.

But Arjun had a plan. He followed the "3-2-1 Rule": solve 3 easy problems, 2 medium problems, and attempt 1 hard problem every single day. He used a spreadsheet to track every problem โ€” topic, time taken, whether he needed the editorial. He gave one virtual contest every week on Codeforces.

Month 1: Rating 800 (Newbie). Month 2: 1000 (Pupil). Month 3: 1200 (Pupil). Month 4: 1400 (Specialist). Month 5: 1500. Month 6: 1623 โ€” Expert.

His Codeforces profile became his resume. Razorpay's hiring team noticed his consistent contest participation during their off-campus drive. In the interview, Arjun solved a DP optimization problem in 12 minutes that stumped other candidates for 45 minutes. Offer: โ‚น18 LPA as SDE-1.

What changed? Not talent โ€” strategy. Arjun didn't grind randomly. He followed a structured approach: identify weak topics โ†’ practice deliberately โ†’ compete regularly โ†’ build a visible profile. This chapter teaches you that exact strategy.

๐Ÿ‡ฎ๐Ÿ‡ณ Razorpay๐Ÿ‡ฎ๐Ÿ‡ณ Google India๐Ÿ‡ฎ๐Ÿ‡ณ Flipkart๐Ÿ‡ฎ๐Ÿ‡ณ Amazon India๐Ÿ‡ฎ๐Ÿ‡ณ PhonePe๐Ÿ‡ฎ๐Ÿ‡ณ Atlassian
In India, companies like Google, Amazon, and Flipkart actively scout Codeforces and CodeChef profiles. A Codeforces Expert (1600+) rating is equivalent to clearing the first 2 rounds of most product-based company interviews. Over 60% of Google India SDE-1 hires in 2024 had competitive programming backgrounds (internal data shared at Google Kickstart events).
Section B

Learning Outcomes โ€” Bloom's Taxonomy Mapped (12 Outcomes)

Bloom's LevelLearning Outcome
๐Ÿ”ต RememberList the rating tiers of Codeforces (Newbie โ†’ Legendary Grandmaster) and recall Big-O complexities for all major algorithms covered in Units 1โ€“6
๐Ÿ”ต RememberIdentify the top 5 competitive programming platforms and their contest formats (Codeforces, CodeChef, LeetCode, AtCoder, HackerRank)
๐ŸŸข UnderstandExplain contest strategy: how to read all problems first, sort by estimated difficulty, and decide when to skip a problem
๐ŸŸข UnderstandDescribe the "brute force โ†’ observe pattern โ†’ optimize โ†’ reduce to known problem" framework for approaching contest problems
๐ŸŸก ApplySet up profiles on Codeforces, CodeChef, and LeetCode; participate in at least one live contest; solve 5+ problems across difficulty levels
๐ŸŸก ApplyBuild and deploy at least 3 portfolio projects from Units 1โ€“6 with proper GitHub READMEs and live demos
๐ŸŸ  AnalyzeCompare rating systems across platforms (Codeforces ELO vs CodeChef vs LeetCode) and determine which best suits personal career goals
๐ŸŸ  AnalyzeAnalyze the top 30 interview coding questions by pattern (arrays, DP, backtracking, etc.) and identify which patterns are most frequently asked at top Indian companies
๐Ÿ”ด EvaluateAssess your own competitive programming profile and create a personalized 90-day improvement plan with measurable milestones
๐Ÿ”ด EvaluateEvaluate a cold email template for SDE applications and critique its effectiveness for the Indian job market
๐ŸŸฃ CreateDesign a complete competitive programming portfolio website showcasing projects, ratings, achievements, and a resume tailored for SDE roles
๐ŸŸฃ CreateCreate a 6-month competitive programming training plan that integrates contest participation, topic mastery, portfolio building, and interview preparation
Section C

Concepts โ€” Contest Strategy, Portfolio, Interviews & Career

Part 1: Contest Strategy

1.1 How to Approach a Competitive Programming Contest

๐ŸŽฏ The First 10 Minutes โ€” The Most Important Phase

Step 1: Read ALL problems (5โ€“8 min). Don't start coding the first problem immediately. Quickly scan every problem statement. Read the input/output examples. Identify which problems are implementation-based (easy), which require a known algorithm, and which are tricky.

Step 2: Sort by YOUR difficulty (2โ€“3 min). Codeforces problems are roughly sorted A (easiest) โ†’ F (hardest), but not always. You might find C easier than B if it matches your strengths. Mark each problem mentally: ๐ŸŸข (can solve), ๐ŸŸก (might solve), ๐Ÿ”ด (skip for now).

Step 3: Solve ๐ŸŸข problems first. Get the easy AC (Accepted) verdicts quickly. Each solved problem gives you confidence and rating points. Speed matters โ€” for equal scores, faster submission time wins.

Step 4: Attack ๐ŸŸก problems. Try your approach. If stuck for 15 minutes, move on. Come back later with fresh eyes.

Step 5: Final 10 minutes โ€” review and hack. Double-check edge cases. On Codeforces, you can "hack" other solutions during the hack phase to gain extra points.

Spending 60+ minutes on one problem while ignoring easier ones. Many beginners get fixated on Problem B and never even read Problem C, which might be simpler. Always read ALL problems first. A solved easy problem is worth more than an unsolved hard one.

1.2 Time Management โ€” When to Skip a Problem

SituationActionWhy
Stuck for 15 min with no progressSkip. Move to next problem.Diminishing returns โ€” fresh problems = fresh energy
You see the approach but implementation is 100+ linesEstimate time. If <30 min left, skip to simpler ones.Long implementation = more bugs = more debugging time
Getting Wrong Answer on test case #47Check edge cases: n=0, n=1, max values, negative numbers90% of WA errors are edge cases, not logic errors
Time Limit Exceeded (TLE)Is your solution O(nยฒ) when it needs O(n log n)?Optimize algorithm, don't micro-optimize code
Runtime Error (RE)Check array bounds, division by zero, stack overflow (recursion depth)Use sys.setrecursionlimit() in Python; check INT_MAX in C++
The 20-Minute Rule: If you've been stuck on a problem for 20 minutes during a contest with no clear path forward, move on. After the contest, read the editorial. This is how you learn fastest. Most Expert-level competitive programmers follow this discipline religiously.

1.3 Common Problem-Solving Patterns

๐Ÿ”„ The 4-Step Pattern Recognition Framework

Step 1 โ€” Brute Force First: Can you solve it with nested loops / recursion checking all possibilities? If N โ‰ค 20, brute force works. Write it, get AC or partial score, then optimize.

Step 2 โ€” Observe Pattern: Run your brute force on small inputs. Print intermediate results. Do you see a mathematical pattern? A recurrence relation? Repeated subproblems (โ†’ DP)?

Step 3 โ€” Optimize: Can you remove redundant computation? Use prefix sums, sliding window, binary search, or memoization to reduce complexity? Sort the input first?

Step 4 โ€” Reduce to Known Problem: Does this look like a shortest path (โ†’ Dijkstra/BFS)? Maximum subarray (โ†’ Kadane's)? Subset sum (โ†’ DP)? String matching (โ†’ KMP/Z-algo)? Recognizing known problems is the #1 skill of expert competitive programmers.

C++ โ€” Brute Force โ†’ Optimized Example
// Problem: Find two numbers in array that sum to target
// BRUTE FORCE: O(nยฒ)
for(int i=0; i<n; i++)
    for(int j=i+1; j<n; j++)
        if(a[i]+a[j]==target) return {i,j};

// OPTIMIZED: O(n) using hash map
unordered_map<int,int> mp;
for(int i=0; i<n; i++){
    if(mp.count(target-a[i])) return {mp[target-a[i]], i};
    mp[a[i]] = i;
}

1.4 Rating Systems Explained

PlatformRating SystemKey TiersContest Frequency
CodeforcesELO-based (like chess)Newbie(<1200), Pupil(1200), Specialist(1400), Expert(1600), CM(1900), Master(2100), GM(2400), IGM(2600+), LGM(3000+)2โ€“3/week
CodeChefStar-based1โ˜…(<1400), 2โ˜…(1400), 3โ˜…(1600), 4โ˜…(1800), 5โ˜…(2000), 6โ˜…(2200), 7โ˜…(2500+)Weekly + Long/Cook-Off
LeetCodeContest RatingUnrated, Guardian(โ‰ฅ2000), Knight(โ‰ฅ1800)Weekly + Biweekly
AtCoderELO-basedGray(<400), Brown(400), Green(800), Cyan(1200), Blue(1600), Yellow(2000), Orange(2400), Red(2800+)Weekly
For Indian job hunting, Codeforces + LeetCode is the winning combo. Codeforces for competitive programming credibility (Google, Flipkart, Razorpay check this). LeetCode for interview prep (Amazon, Microsoft, Meta use LeetCode-style questions). CodeChef is great for beginners and has a strong Indian community.

1.5 The Ideal Practice Schedule

๐Ÿ“… Weekly Schedule for Rating Growth

Daily (1.5โ€“2 hours):

โ€ข Solve 2โ€“3 problems on Codeforces/LeetCode (1 easy, 1 medium, attempt 1 hard)

โ€ข If you can't solve in 30 min, read the editorial, understand it, then implement from scratch

โ€ข Log every problem: topic, time, solved/unsolved, key insight

Weekly (2โ€“3 hours):

โ€ข Participate in 1 live rated contest (Codeforces Div. 2 or LeetCode Weekly)

โ€ข After contest: upsolve โ€” solve the problems you couldn't during contest using editorials

Monthly:

โ€ข Review your problem log. Identify weakest topics.

โ€ข Dedicate next month's practice to those weak areas

โ€ข Update your Codeforces/GitHub profile

Upsolving is where real growth happens. After every contest, solve 1โ€“2 problems you couldn't during the contest. This is the single most effective practice technique. Top competitive programmers spend more time upsolving than competing.

Part 2: Portfolio Projects (from All 6 Units)

These 6 projects, built throughout Units 1โ€“6, form your competitive programming portfolio. Each project demonstrates a different algorithmic skill set.

๐Ÿ“Š Project 1: Complexity Analyzer Tool Unit 1

Description: A web-based tool that takes a code snippet (C++/Python/Java) and estimates its time complexity by analyzing loop structures, recursion depth, and known algorithm patterns. Displays the Big-O notation with an explanation of how it was derived.

Tech Stack: HTML/CSS/JavaScript (frontend), Python Flask (backend for parsing), Regular Expressions for pattern matching

Key Features:

โ€ข Paste code โ†’ get O(n), O(nยฒ), O(log n), etc.

โ€ข Visual complexity graph showing growth curves

โ€ข Side-by-side comparison of O(n) vs O(nยฒ) vs O(n log n) for user-provided input size

GitHub README Template:

Markdown
# โฑ๏ธ Complexity Analyzer Tool
> Analyze time complexity of code snippets instantly

## Features
- Paste C++/Python/Java code and get Big-O estimate
- Visual growth curve comparison
- Supports loops, recursion, and common patterns

## Tech Stack
- Frontend: HTML, CSS, JavaScript (Chart.js)
- Backend: Python (Flask), AST parsing

## Setup
```bash
pip install flask
python app.py
```

## Screenshots
[Add screenshots here]

## Author
[Your Name] | Codeforces: [handle] | LinkedIn: [URL]

๐Ÿ”ข Project 2: Prime Number Generator & Sieve Visualizer Unit 2

Description: An interactive visualizer that demonstrates the Sieve of Eratosthenes in real-time. Users input N and watch as the sieve eliminates composite numbers step by step, with color-coded cells. Also includes prime factorization and prime gap analysis.

Tech Stack: HTML/CSS/JavaScript (vanilla), Canvas API for animation

Key Features:

โ€ข Step-by-step animation of Sieve of Eratosthenes

โ€ข Speed control slider (slow for learning, fast for large N)

โ€ข Prime factorization calculator

โ€ข Statistics: prime count, density, largest gap

GitHub README Template:

Markdown
# ๐Ÿ”ข Prime Sieve Visualizer
> Watch the Sieve of Eratosthenes in action

## Features
- Real-time step-by-step sieve animation
- Color-coded prime/composite cells
- Prime factorization tool
- Works up to N = 100,000

## Tech Stack
- Pure HTML/CSS/JavaScript
- Canvas API for animation

## Live Demo
[Deploy on GitHub Pages โ€” link here]

๐Ÿ‘‘ Project 3: N-Queens / Sudoku Solver with Visualization Unit 3

Description: A visual backtracking solver that animates the placement and removal of queens on an Nร—N chessboard, or fills a Sudoku grid step-by-step. Users can see the backtracking algorithm "think" in real-time as it explores and prunes branches.

Tech Stack: HTML/CSS Grid for board layout, JavaScript for backtracking engine, CSS animations

Key Features:

โ€ข Animated queen placement with conflict highlighting

โ€ข Adjustable board size (4ร—4 to 12ร—12)

โ€ข Sudoku solver: input any puzzle or generate random ones

โ€ข Step counter and backtrack counter to show algorithm efficiency

GitHub README Template:

Markdown
# ๐Ÿ‘‘ N-Queens & Sudoku Visual Solver
> Watch backtracking algorithms solve puzzles in real-time

## Features
- N-Queens solver with animated queen placement
- Sudoku solver with step-by-step filling
- Adjustable speed and board size
- Backtrack counter shows algorithm efficiency

## Tech Stack
- HTML/CSS Grid, JavaScript
- No external dependencies

## How It Works
Uses recursive backtracking with constraint propagation.

๐Ÿ“‹ Project 4: DP Problem Solver with Table Visualization Unit 4

Description: An interactive tool that visualizes how dynamic programming tables are filled for classic problems: Fibonacci, Coin Change, Edit Distance, and Matrix Chain Multiplication. Users see cells being filled in real-time with arrows showing dependencies.

Tech Stack: HTML/CSS/JavaScript, D3.js for dependency arrows

Key Features:

โ€ข Select from 5+ classic DP problems

โ€ข Watch the DP table fill cell-by-cell with animation

โ€ข Dependency arrows show which cells contribute to each result

โ€ข Toggle between top-down (memoization) and bottom-up (tabulation) views

GitHub README Template:

Markdown
# ๐Ÿ“‹ DP Table Visualizer
> See how Dynamic Programming tables are filled step-by-step

## Supported Problems
- Fibonacci, Coin Change, Edit Distance
- 0/1 Knapsack, LCS, Matrix Chain Multiplication

## Features
- Animated table filling
- Dependency arrows
- Top-down vs Bottom-up comparison

## Tech Stack
- HTML/CSS/JavaScript, D3.js

๐ŸŽ’ Project 5: Knapsack / LIS / LCS Interactive Demo Unit 5

Description: A hands-on interactive demo where users input their own items (weight, value) for Knapsack, or sequences for LIS/LCS, and watch the algorithm solve it. Includes side-by-side comparison of greedy vs DP approaches for Knapsack.

Tech Stack: React.js (or vanilla JS), CSS Grid for tables, Chart.js for comparison graphs

Key Features:

โ€ข Custom input: add/remove items for Knapsack, edit sequences for LIS/LCS

โ€ข Greedy vs DP comparison with visual output

โ€ข Optimal solution highlighted in the DP table

โ€ข Export results as image or PDF

GitHub README Template:

Markdown
# ๐ŸŽ’ Knapsack / LIS / LCS Interactive Demo
> Explore classic optimization problems interactively

## Features
- Custom input for all problems
- Greedy vs DP visual comparison
- Step-by-step solution tracing
- Responsive design

## Tech Stack
- JavaScript, Chart.js, CSS Grid

๐Ÿ“Š Project 6: Sorting Algorithm Visualizer & Benchmarker Unit 6

Description: A comprehensive sorting visualizer that animates 8+ sorting algorithms side-by-side. Includes a benchmarking mode that times each algorithm on the same random data and displays results in a chart. Users can see WHY Quick Sort beats Bubble Sort.

Tech Stack: HTML/CSS/JavaScript, Canvas API for bar animations, Web Workers for non-blocking sort execution

Key Features:

โ€ข Algorithms: Bubble, Selection, Insertion, Merge, Quick, Heap, Counting, Radix

โ€ข Side-by-side race mode: watch 2โ€“4 algorithms sort simultaneously

โ€ข Benchmark mode: time comparison graph for arrays of size 100 to 100,000

โ€ข Sound mode: each swap produces a tone (pitch = element value)

GitHub README Template:

Markdown
# ๐Ÿ“Š Sorting Algorithm Visualizer & Benchmarker
> See sorting algorithms race in real-time

## Algorithms
Bubble, Selection, Insertion, Merge, Quick, Heap, Counting, Radix

## Features
- Real-time animated sorting
- Side-by-side algorithm racing
- Benchmarking with performance charts
- Sound mode for auditory learning

## Tech Stack
- Vanilla JavaScript, Canvas API, Web Workers
A portfolio with these 6 projects puts you in the top 5% of BCA/B.Tech graduates in India. Most students have ZERO projects on GitHub. Having 6 well-documented, deployed projects with live demos is equivalent to 6 months of internship experience in the eyes of recruiters at companies like Google, Flipkart, and Amazon.

Part 3: Top 30 Competitive Coding Interview Questions

These 30 questions are organized by pattern. Each includes the approach hint, code, complexity, and which company has asked it. Master these patterns, and you'll handle 80% of coding interview questions.

๐Ÿ”ต Pattern 1: Array / String Manipulation (5 Questions)

Q1. Two Sum โ€” Find two numbers that add up to a target
Asked at: Amazon, Google, Flipkart

Approach: Use a hash map. For each element, check if (target - element) exists in the map.

C++
vector<int> twoSum(vector<int>& nums, int target) {
    unordered_map<int,int> mp;
    for(int i=0; i<nums.size(); i++){
        if(mp.count(target - nums[i]))
            return {mp[target-nums[i]], i};
        mp[nums[i]] = i;
    }
    return {};
}

Complexity: Time O(n), Space O(n)

Q2. Kadane's Algorithm โ€” Maximum Subarray Sum
Asked at: Microsoft, Razorpay, Paytm

Approach: Track current_sum and max_sum. If current_sum goes negative, reset to 0.

C++
int maxSubArray(vector<int>& nums) {
    int maxSum = nums[0], curSum = 0;
    for(int x : nums){
        curSum = max(x, curSum + x);
        maxSum = max(maxSum, curSum);
    }
    return maxSum;
}

Complexity: Time O(n), Space O(1)

Q3. Longest Substring Without Repeating Characters
Asked at: Amazon, Adobe, Intuit

Approach: Use sliding window with a hash set to track characters in current window.

C++
int lengthOfLongestSubstring(string s) {
    unordered_set<char> seen;
    int l = 0, ans = 0;
    for(int r = 0; r < s.size(); r++){
        while(seen.count(s[r])){
            seen.erase(s[l]);
            l++;
        }
        seen.insert(s[r]);
        ans = max(ans, r - l + 1);
    }
    return ans;
}

Complexity: Time O(n), Space O(min(n, 26))

Q4. Next Permutation
Asked at: Google, Flipkart, Uber

Approach: Find rightmost ascent, swap with next larger element, reverse suffix.

C++
void nextPermutation(vector<int>& nums) {
    int n = nums.size(), i = n-2;
    while(i >= 0 && nums[i] >= nums[i+1]) i--;
    if(i >= 0){
        int j = n-1;
        while(nums[j] <= nums[i]) j--;
        swap(nums[i], nums[j]);
    }
    reverse(nums.begin()+i+1, nums.end());
}

Complexity: Time O(n), Space O(1)

Q5. Rotate Array by K Positions
Asked at: TCS, Infosys, Wipro

Approach: Reverse the whole array, then reverse first K elements, then reverse remaining.

C++
void rotate(vector<int>& nums, int k) {
    k %= nums.size();
    reverse(nums.begin(), nums.end());
    reverse(nums.begin(), nums.begin()+k);
    reverse(nums.begin()+k, nums.end());
}

Complexity: Time O(n), Space O(1)

๐ŸŸข Pattern 2: Two Pointer / Sliding Window (5 Questions)

Q6. Container With Most Water
Asked at: Amazon, Google, PhonePe

Approach: Two pointers at ends. Move the shorter line inward โ€” we can only get more water by finding a taller line.

C++
int maxArea(vector<int>& h) {
    int l = 0, r = h.size()-1, ans = 0;
    while(l < r){
        ans = max(ans, min(h[l],h[r])*(r-l));
        if(h[l] < h[r]) l++;
        else r--;
    }
    return ans;
}

Complexity: Time O(n), Space O(1)

Q7. 3Sum โ€” Find all unique triplets summing to zero
Asked at: Facebook, Atlassian, Razorpay

Approach: Sort array. Fix one element, use two pointers for the remaining pair. Skip duplicates.

C++
vector<vector<int>> threeSum(vector<int>& nums) {
    sort(nums.begin(), nums.end());
    vector<vector<int>> res;
    for(int i = 0; i < (int)nums.size()-2; i++){
        if(i > 0 && nums[i]==nums[i-1]) continue;
        int l=i+1, r=nums.size()-1;
        while(l < r){
            int s = nums[i]+nums[l]+nums[r];
            if(s==0){ res.push_back({nums[i],nums[l],nums[r]});
                while(l<r && nums[l]==nums[l+1]) l++;
                while(l<r && nums[r]==nums[r-1]) r--;
                l++; r--;
            } else if(s<0) l++; else r--;
        }
    }
    return res;
}

Complexity: Time O(nยฒ), Space O(1) extra

Q8. Minimum Window Substring
Asked at: Google, Microsoft, Uber

Approach: Expand window right to include all chars of t, then shrink from left to minimize.

C++
string minWindow(string s, string t) {
    unordered_map<char,int> need, have;
    for(char c : t) need[c]++;
    int required = need.size(), formed = 0;
    int l = 0, bestL = 0, bestLen = INT_MAX;
    for(int r = 0; r < s.size(); r++){
        have[s[r]]++;
        if(need.count(s[r]) && have[s[r]]==need[s[r]]) formed++;
        while(formed == required){
            if(r-l+1 < bestLen){ bestLen = r-l+1; bestL = l; }
            have[s[l]]--;
            if(need.count(s[l]) && have[s[l]]<need[s[l]]) formed--;
            l++;
        }
    }
    return bestLen==INT_MAX ? "" : s.substr(bestL, bestLen);
}

Complexity: Time O(|s| + |t|), Space O(|s| + |t|)

Q9. Trapping Rain Water
Asked at: Amazon, Google, Goldman Sachs

Approach: Two pointers from both ends. Track leftMax and rightMax. Water at position = min(leftMax, rightMax) - height.

C++
int trap(vector<int>& h) {
    int l=0, r=h.size()-1, lMax=0, rMax=0, ans=0;
    while(l < r){
        if(h[l] < h[r]){
            h[l] >= lMax ? lMax=h[l] : ans += lMax-h[l];
            l++;
        } else {
            h[r] >= rMax ? rMax=h[r] : ans += rMax-h[r];
            r--;
        }
    }
    return ans;
}

Complexity: Time O(n), Space O(1)

Q10. Longest Repeating Character Replacement
Asked at: Microsoft, Flipkart, Swiggy

Approach: Sliding window. Track max frequency char in window. If window_size - max_freq > k, shrink window.

C++
int characterReplacement(string s, int k) {
    int cnt[26]={}, l=0, maxF=0, ans=0;
    for(int r=0; r<s.size(); r++){
        maxF = max(maxF, ++cnt[s[r]-'A']);
        while(r-l+1-maxF > k)
            cnt[s[l++]-'A']--;
        ans = max(ans, r-l+1);
    }
    return ans;
}

Complexity: Time O(n), Space O(1)

๐ŸŸก Pattern 3: Recursion / Backtracking (5 Questions)

Q11. Generate All Permutations of a String/Array
Asked at: Google, Amazon, Zoho

Approach: Fix one element, recursively permute the rest. Use swap-based backtracking.

C++
void permute(vector<int>& nums, int idx, vector<vector<int>>& res){
    if(idx == nums.size()){ res.push_back(nums); return; }
    for(int i = idx; i < nums.size(); i++){
        swap(nums[idx], nums[i]);
        permute(nums, idx+1, res);
        swap(nums[idx], nums[i]); // backtrack
    }
}

Complexity: Time O(n ร— n!), Space O(n)

Q12. N-Queens Problem
Asked at: Google, Apple, Directi

Approach: Place queens row by row. Use sets/arrays to track columns and diagonals under attack.

C++
void solve(int row, int n, vector<string>& board,
          vector<bool>& col, vector<bool>& d1, vector<bool>& d2,
          vector<vector<string>>& res){
    if(row==n){ res.push_back(board); return; }
    for(int c=0; c<n; c++){
        if(col[c]||d1[row-c+n-1]||d2[row+c]) continue;
        board[row][c] = 'Q';
        col[c]=d1[row-c+n-1]=d2[row+c]=true;
        solve(row+1, n, board, col, d1, d2, res);
        board[row][c] = '.';
        col[c]=d1[row-c+n-1]=d2[row+c]=false;
    }
}

Complexity: Time O(n!), Space O(nยฒ)

Q13. Subset Sum โ€” Does a subset exist with given sum?
Asked at: Amazon, Samsung, Walmart

Approach: For each element, two choices: include or exclude. Recursion with memoization (DP).

C++
bool subsetSum(vector<int>& nums, int target) {
    int n = nums.size();
    vector<vector<bool>> dp(n+1, vector<bool>(target+1, false));
    for(int i=0; i<=n; i++) dp[i][0] = true;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=target; j++){
            dp[i][j] = dp[i-1][j];
            if(j >= nums[i-1]) dp[i][j] = dp[i][j] || dp[i-1][j-nums[i-1]];
        }
    return dp[n][target];
}

Complexity: Time O(n ร— target), Space O(n ร— target)

Q14. Word Search in Grid
Asked at: Microsoft, Google, Uber

Approach: DFS from each cell. Mark visited cells, backtrack after exploring.

C++
bool dfs(vector<vector<char>>& board, string& word, int i, int j, int k){
    if(k==word.size()) return true;
    if(i<0||j<0||i>=board.size()||j>=board[0].size()||board[i][j]!=word[k])
        return false;
    char tmp = board[i][j];
    board[i][j] = '#'; // mark visited
    bool found = dfs(board,word,i+1,j,k+1) || dfs(board,word,i-1,j,k+1)
                || dfs(board,word,i,j+1,k+1) || dfs(board,word,i,j-1,k+1);
    board[i][j] = tmp; // backtrack
    return found;
}

Complexity: Time O(m ร— n ร— 4^L), Space O(L) where L = word length

Q15. Sudoku Solver
Asked at: Amazon, Flipkart, Directi

Approach: Try digits 1โ€“9 in empty cells. Check row, column, and 3ร—3 box constraints. Backtrack on conflict.

C++
bool isValid(vector<vector<char>>& b, int r, int c, char d){
    for(int i=0; i<9; i++){
        if(b[r][i]==d || b[i][c]==d) return false;
        if(b[r/3*3+i/3][c/3*3+i%3]==d) return false;
    }
    return true;
}
bool solve(vector<vector<char>>& b){
    for(int i=0;i<9;i++)
        for(int j=0;j<9;j++)
            if(b[i][j]=='.'){
                for(char d='1';d<='9';d++){
                    if(isValid(b,i,j,d)){
                        b[i][j]=d;
                        if(solve(b)) return true;
                        b[i][j]='.';
                    }
                }
                return false;
            }
    return true;
}

Complexity: Time O(9^(empty cells)), Space O(81)

๐ŸŸ  Pattern 4: Dynamic Programming (5 Questions)

Q16. Longest Common Subsequence (LCS)
Asked at: Google, Amazon, Intuit

Approach: Classic 2D DP. If chars match, dp[i][j] = dp[i-1][j-1]+1; else max of dp[i-1][j], dp[i][j-1].

C++
int longestCommonSubsequence(string a, string b) {
    int m=a.size(), n=b.size();
    vector<vector<int>> dp(m+1, vector<int>(n+1, 0));
    for(int i=1; i<=m; i++)
        for(int j=1; j<=n; j++)
            dp[i][j] = a[i-1]==b[j-1] ? dp[i-1][j-1]+1
                       : max(dp[i-1][j], dp[i][j-1]);
    return dp[m][n];
}

Complexity: Time O(m ร— n), Space O(m ร— n) [can optimize to O(n)]

Q17. 0/1 Knapsack Problem
Asked at: Flipkart, Samsung, Paytm

Approach: For each item, choose to include (if weight allows) or exclude. Tabulate bottom-up.

C++
int knapsack(vector<int>& wt, vector<int>& val, int W) {
    int n = wt.size();
    vector<vector<int>> dp(n+1, vector<int>(W+1, 0));
    for(int i=1; i<=n; i++)
        for(int w=0; w<=W; w++){
            dp[i][w] = dp[i-1][w];
            if(wt[i-1]<=w)
                dp[i][w] = max(dp[i][w], val[i-1]+dp[i-1][w-wt[i-1]]);
        }
    return dp[n][W];
}

Complexity: Time O(n ร— W), Space O(n ร— W)

Q18. Longest Increasing Subsequence (LIS)
Asked at: Google, Microsoft, Atlassian

Approach: O(n log n) using binary search with a tails array. Maintain the smallest possible tail for each LIS length.

C++
int lengthOfLIS(vector<int>& nums) {
    vector<int> tails;
    for(int x : nums){
        auto it = lower_bound(tails.begin(), tails.end(), x);
        if(it == tails.end()) tails.push_back(x);
        else *it = x;
    }
    return tails.size();
}

Complexity: Time O(n log n), Space O(n)

Q19. Coin Change โ€” Minimum coins to make amount
Asked at: Amazon, Razorpay, PhonePe

Approach: DP where dp[i] = minimum coins needed for amount i. Try each coin denomination.

C++
int coinChange(vector<int>& coins, int amount) {
    vector<int> dp(amount+1, amount+1);
    dp[0] = 0;
    for(int i=1; i<=amount; i++)
        for(int c : coins)
            if(c <= i)
                dp[i] = min(dp[i], dp[i-c]+1);
    return dp[amount] > amount ? -1 : dp[amount];
}

Complexity: Time O(amount ร— coins), Space O(amount)

Q20. Edit Distance (Levenshtein Distance)
Asked at: Google, Meta, Directi

Approach: 2D DP. dp[i][j] = min operations to convert word1[0..i-1] to word2[0..j-1].

C++
int minDistance(string a, string b) {
    int m=a.size(), n=b.size();
    vector<vector<int>> dp(m+1, vector<int>(n+1));
    for(int i=0; i<=m; i++) dp[i][0] = i;
    for(int j=0; j<=n; j++) dp[0][j] = j;
    for(int i=1; i<=m; i++)
        for(int j=1; j<=n; j++){
            if(a[i-1]==b[j-1]) dp[i][j] = dp[i-1][j-1];
            else dp[i][j] = 1 + min({dp[i-1][j], dp[i][j-1], dp[i-1][j-1]});
        }
    return dp[m][n];
}

Complexity: Time O(m ร— n), Space O(m ร— n)

๐Ÿ”ด Pattern 5: Number Theory / Math (5 Questions)

Q21. Sieve of Eratosthenes โ€” Generate all primes up to N
Asked at: Samsung, Zoho, TCS NQT

Approach: Mark multiples of each prime starting from 2. Only need to check up to โˆšN.

C++
vector<bool> sieve(int n) {
    vector<bool> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for(int i=2; i*i<=n; i++)
        if(is_prime[i])
            for(int j=i*i; j<=n; j+=i)
                is_prime[j] = false;
    return is_prime;
}

Complexity: Time O(n log log n), Space O(n)

Q22. GCD using Euclidean Algorithm
Asked at: Infosys, Wipro, Capgemini

Approach: GCD(a, b) = GCD(b, a % b). Base case: GCD(a, 0) = a.

C++
int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}
// LCM(a,b) = (a / gcd(a,b)) * b  (avoid overflow)

Complexity: Time O(log(min(a,b))), Space O(log(min(a,b))) recursive / O(1) iterative

Q23. Modular Exponentiation (Fast Power)
Asked at: Codeforces, CodeChef, Google

Approach: Binary exponentiation: a^b = (a^(b/2))ยฒ if even, a ร— a^(b-1) if odd. All mod p.

C++
long long power(long long a, long long b, long long mod) {
    long long res = 1;
    a %= mod;
    while(b > 0){
        if(b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

Complexity: Time O(log b), Space O(1)

Q24. Count Trailing Zeros in N!
Asked at: Amazon, Flipkart, Zoho

Approach: Count factors of 5 in N! โ†’ N/5 + N/25 + N/125 + ...

C++
int trailingZeros(int n) {
    int count = 0;
    while(n >= 5){
        count += n / 5;
        n /= 5;
    }
    return count;
}

Complexity: Time O(logโ‚… n), Space O(1)

Q25. Check if a Number is Power of Two
Asked at: TCS NQT, Infosys, Microsoft

Approach: A power of 2 has exactly one bit set. n & (n-1) removes the lowest set bit โ€” if result is 0, it's a power of 2.

C++
bool isPowerOfTwo(int n) {
    return n > 0 && (n & (n - 1)) == 0;
}

Complexity: Time O(1), Space O(1)

๐ŸŸฃ Pattern 6: Sorting / Searching (5 Questions)

Q26. Binary Search โ€” Search in Rotated Sorted Array
Asked at: Amazon, Google, Uber

Approach: Modified binary search. Determine which half is sorted, then check if target lies in that half.

C++
int search(vector<int>& nums, int target) {
    int l=0, r=nums.size()-1;
    while(l <= r){
        int mid = l+(r-l)/2;
        if(nums[mid]==target) return mid;
        if(nums[l] <= nums[mid]){
            if(target >= nums[l] && target < nums[mid]) r = mid-1;
            else l = mid+1;
        } else {
            if(target > nums[mid] && target <= nums[r]) l = mid+1;
            else r = mid-1;
        }
    }
    return -1;
}

Complexity: Time O(log n), Space O(1)

Q27. Merge Sort โ€” Count Inversions in Array
Asked at: Google, Goldman Sachs, Flipkart

Approach: During merge step of merge sort, count when right element is placed before left elements.

C++
long long mergeCount(vector<int>& arr, int l, int r){
    if(l >= r) return 0;
    int mid = (l+r)/2;
    long long inv = mergeCount(arr,l,mid) + mergeCount(arr,mid+1,r);
    vector<int> tmp;
    int i=l, j=mid+1;
    while(i<=mid && j<=r){
        if(arr[i]<=arr[j]) tmp.push_back(arr[i++]);
        else{ tmp.push_back(arr[j++]); inv += mid-i+1; }
    }
    while(i<=mid) tmp.push_back(arr[i++]);
    while(j<=r) tmp.push_back(arr[j++]);
    for(int k=l; k<=r; k++) arr[k]=tmp[k-l];
    return inv;
}

Complexity: Time O(n log n), Space O(n)

Q28. Kth Largest Element (Quick Select)
Asked at: Meta, Amazon, Microsoft

Approach: Partition like Quick Sort. If pivot index = n-k, found. Else search in appropriate half.

C++
int findKthLargest(vector<int>& nums, int k) {
    int n = nums.size();
    nth_element(nums.begin(), nums.begin()+n-k, nums.end());
    return nums[n-k];
}
// STL nth_element uses Introselect: avg O(n), worst O(n)

Complexity: Time O(n) average, Space O(1)

Q29. Merge K Sorted Lists / Arrays
Asked at: Google, Amazon, Uber

Approach: Use a min-heap (priority queue). Push first element of each list. Pop min, push next from that list.

C++
// Merging K sorted vectors
vector<int> mergeKSorted(vector<vector<int>>& lists) {
    // {value, list_index, element_index}
    priority_queue<tuple<int,int,int>,
        vector<tuple<int,int,int>>,
        greater<>> pq;
    for(int i=0; i<lists.size(); i++)
        if(!lists[i].empty())
            pq.push({lists[i][0], i, 0});
    vector<int> res;
    while(!pq.empty()){
        auto [val, li, ei] = pq.top(); pq.pop();
        res.push_back(val);
        if(ei+1 < lists[li].size())
            pq.push({lists[li][ei+1], li, ei+1});
    }
    return res;
}

Complexity: Time O(N log K), Space O(K) where N = total elements, K = number of lists

Q30. Find Peak Element
Asked at: Microsoft, Amazon, PhonePe

Approach: Binary search. If mid > mid+1, peak is in left half (including mid). Else in right half.

C++
int findPeakElement(vector<int>& nums) {
    int l = 0, r = nums.size()-1;
    while(l < r){
        int mid = l + (r-l)/2;
        if(nums[mid] > nums[mid+1]) r = mid;
        else l = mid + 1;
    }
    return l;
}

Complexity: Time O(log n), Space O(1)

Part 4: Career Guidance for Competitive Programmers

4.1 Codeforces / CodeChef Profile Optimization

๐Ÿ“‹ Your CP Profile = Your Resume

Codeforces Profile Checklist:

โœ… Real name (not a meme handle) โ€” recruiters need to identify you

โœ… Organization: "BCA Student at [College Name]" or "B.Tech CSE at [University]"

โœ… City: Add your city โ€” helps with local job matching

โœ… Contribution: +ve contribution shows you're an active community member (write editorials!)

โœ… Consistent contest participation: Minimum 1 contest/week. Rating curve should trend upward

โœ… Blogs: Write 2โ€“3 editorials for problems you solved โ€” shows communication skills

CodeChef Profile Checklist:

โœ… Link GitHub and LinkedIn accounts

โœ… Earn badges: Problem Setter, Contest Winner, etc.

โœ… Complete the "Practice" section problems by difficulty

4.2 LinkedIn for Competitive Programmers

๐Ÿ”— LinkedIn Headline Formula

Formula: [Role Target] | [CP Achievement] | [Tech Stack]

Example: "Aspiring SDE | Codeforces Expert (1650+) | C++ โ€ข Python โ€ข DSA | 500+ Problems Solved"

About Section Template:

Text
๐Ÿ† Competitive Programmer | Codeforces Expert (1650+) | CodeChef 4โ˜…
๐Ÿ“Š 500+ problems solved across Codeforces, LeetCode, and CodeChef
๐Ÿ’ป Proficient in C++, Python, Data Structures & Algorithms

๐ŸŽฏ Key Achievements:
โ€ข Codeforces Expert (1600+) โ€” Top 8% globally
โ€ข Ranked in Top 500 in CodeChef Starters #128
โ€ข Built 6 algorithm visualization projects (links below)

๐Ÿ”ง Technical Skills:
โ€ข Languages: C++, Python, Java
โ€ข DS/Algo: DP, Graphs, Trees, Number Theory, Segment Trees
โ€ข Tools: Git, VS Code, GDB

๐Ÿ“ซ Open to SDE roles and internships.
   Email: your.email@gmail.com

4.3 How Top Indian Companies Hire via CP

CompanyHiring ChannelWhat They Look ForTypical CTC (Fresher)
GoogleGoogle Kickstart, Google Code Jam, direct referralCodeforces 1800+ (CM), strong problem solvingโ‚น25โ€“45 LPA
MetaMeta HackerCup, direct applicationHackerCup Round 2+, LeetCode hard problemsโ‚น30โ€“50 LPA
AmazonAmazon CodeDev, OA (Online Assessment)LeetCode medium-hard, system design basicsโ‚น15โ€“25 LPA
FlipkartFlipkart Grid, campus hiringCodeforces 1400+, CodeChef 3โ˜…+โ‚น15โ€“22 LPA
RazorpayDirect application, referrals, off-campusStrong CP profile, problem-solving speedโ‚น14โ€“22 LPA
AtlassianOnline test + interviewsLeetCode medium, system designโ‚น25โ€“40 LPA
PhonePeHiring challenges, referralsCodeforces 1400+, practical coding abilityโ‚น12โ€“20 LPA
TCS DigitalTCS CodeVita, TCS NQTCodeVita National Rank, aptitudeโ‚น7โ€“9 LPA
Google Kickstart (now Google Coding Competitions) was the #1 pathway for Indian tier-2/tier-3 college students to get Google interviews. Many students from colleges like VIT, SRM, KIIT, and even BCA programs have received Google interview calls after performing well in Kickstart rounds. The program has now transitioned, but similar opportunities exist through Google's hiring challenges.

4.4 CP Rating to Salary Mapping (Indian Market 2024โ€“25)

CP Rating (Codeforces)Equivalent LevelExpected Salary RangeCompanies in Range
1200โ€“1400 (Pupil/Specialist)Clears most OA roundsโ‚น4โ€“8 LPATCS, Infosys, Wipro, Cognizant
1400โ€“1600 (Specialist/Expert)Clears product company interviewsโ‚น8โ€“18 LPAFlipkart, Razorpay, PhonePe, Paytm, Swiggy
1600โ€“1900 (Expert/CM)Strong problem solverโ‚น15โ€“30 LPAGoogle, Amazon, Microsoft, Atlassian
1900โ€“2200 (CM/Master)Elite competitive programmerโ‚น25โ€“50 LPAGoogle, Meta, Tower Research, DE Shaw
2200+ (Master/GM)World-classโ‚น40โ€“80+ LPAGoogle L4+, HFT firms, Quant firms
Rating isn't everything. A Specialist (1400) with 3 good projects, a clean resume, and strong communication will beat a CM (1900) who can't explain their approach. Companies hire ENGINEERS, not just problem solvers. Build projects, practice mock interviews, and communicate clearly.

4.5 Cold Email Template for SDE Applications

๐Ÿ“ง Cold Email Template That Gets Responses

Email Template
Subject: BCA Grad | Codeforces Expert (1650+) | Interested in SDE Role at [Company]

Hi [Name],

I'm [Your Name], a recent BCA graduate from [College], Jaipur. I've been
following [Company]'s engineering blog and was impressed by [specific
technical post or product feature].

I'm a competitive programmer with:
โ€ข Codeforces Expert rating: 1650+ (Top 8% globally)
โ€ข 500+ problems solved on Codeforces + LeetCode
โ€ข 6 algorithm visualization projects on GitHub: [link]

I noticed [Company] is hiring for SDE-1 roles. I believe my strong
problem-solving skills and project portfolio make me a good fit.

Would you be open to a 10-minute chat or could you refer me to the
hiring team?

Resume: [Google Drive link]
GitHub: [link]
Codeforces: [link]
LinkedIn: [link]

Thank you for your time!

Best regards,
[Your Name]
[Phone Number]

Tips: Send to engineering managers, not HR. Find them on LinkedIn. Mention something specific about the company. Follow up once after 5 days. Send 10โ€“20 per week.

Students who send 50+ targeted cold emails typically get 3โ€“5 responses and 1โ€“2 interview calls. This approach got a BCA student from Lucknow an interview call from Razorpay, which led to an โ‚น18 LPA offer. Most students never try this โ€” be the one who does.
Section D

Learn by Doing โ€” 3-Tier Lab Structure

๐ŸŸข Tier 1 โ€” GUIDED TASK: Set Up Your CP Ecosystem

โฑ๏ธ 45โ€“60 minutesBeginnerZero prior setup assumed

Step 1: Create Codeforces Account

Go to codeforces.com โ†’ Click "Register" โ†’ Use your real name โ†’ Set organization to "[Your College]"

Step 2: Create CodeChef Account

Go to codechef.com โ†’ Sign up โ†’ Link your GitHub account โ†’ Complete your profile

Step 3: Create LeetCode Account

Go to leetcode.com โ†’ Sign up โ†’ Start with "Top Interview 150" problem set

Step 4: Set Up Your Local Environment

Terminal
# Install C++ compiler (if not already installed)
# Windows: Install MinGW or use WSL
# Mac: xcode-select --install
# Linux: sudo apt install g++

# Create your CP workspace
mkdir competitive-programming
cd competitive-programming
mkdir codeforces leetcode codechef

# Create a template file
cat > template.cpp << 'EOF'
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

void solve(){
    // Your solution here
}

int main(){
    fast
    int t; cin >> t;
    while(t--) solve();
}
EOF

echo "Template created! Ready to compete."

Step 5: Solve Your First 5 Problems

Go to Codeforces โ†’ Problemset โ†’ Sort by difficulty (800) โ†’ Solve these 5:

#ProblemRatingTopic
1Watermelon (4A)800Math / Implementation
2Way Too Long Words (71A)800Strings
3Team (231A)800Implementation
4Next Round (158A)800Implementation
5Domino Piling (50A)800Math

๐ŸŽ‰ Congratulations! You now have accounts on 3 major platforms, a local setup, and 5 solved problems. You're officially a competitive programmer!

๐ŸŸก Tier 2 โ€” SEMI-GUIDED TASK: Participate in a Live Contest

โฑ๏ธ 2โ€“3 hoursIntermediateGuided strategy, you execute

Your Mission:

Participate in a Codeforces Div. 2 contest (or a Virtual Contest if no live contest is happening).

Strategy Guide:

  1. Before the contest: Open your template.cpp. Have a browser tab with C++ reference ready.
  2. First 5 minutes: Read all problems A through E. Mark them ๐ŸŸข๐ŸŸก๐Ÿ”ด.
  3. Solve A within 10 minutes. If it's simple implementation, submit fast.
  4. Solve B within 20 minutes. Check edge cases before submitting.
  5. Attempt C: If stuck for 15 min, move to D if it looks doable.
  6. After contest: Read editorials for ALL problems. Upsolve C and D.
Stretch Goal: Solve 3 problems in your first contest. If you solve A and B, you'll gain rating. Solving C makes you a serious competitor. Track your performance in a spreadsheet.

๐Ÿ”ด Tier 3 โ€” OPEN CHALLENGE: Deploy Your CP Portfolio Website

โฑ๏ธ 3โ€“5 hoursAdvancedNo hand-holding โ€” build from scratch

The Brief:

Create and deploy a personal portfolio website showcasing your competitive programming journey. It should include:

  1. Hero Section: Name, CP handles (linked), current ratings, tagline
  2. Projects Section: 6 portfolio projects with descriptions, tech stacks, and GitHub/demo links
  3. Achievements: Contest participations, best ranks, badges earned
  4. Problem Statistics: Problems solved by topic (embed Codeforces/LeetCode stats)
  5. Resume Download: PDF resume button
  6. Contact Section: Email, LinkedIn, GitHub links

Deployment: Use GitHub Pages (free) or Vercel (free). Your site URL should be yourname.github.io

This portfolio website becomes your most powerful job-hunting tool. Include it in every cold email, LinkedIn profile, and resume. Recruiters spend 6โ€“10 seconds scanning a profile โ€” a clean portfolio website makes you instantly stand out from 1000+ other applicants.
Section E

Cross-Unit Synthesis Problems

These problems require combining concepts from multiple units. They test your ability to choose the right approach from your entire algorithmic toolkit.

๐Ÿงฉ Problem 1: Efficient Event Scheduler (Units 1 + 4 + 6)

Problem: Given N events with start times, end times, and profit values, find the maximum profit subset of non-overlapping events.

Synthesis:

โ€ข Unit 6 (Sorting): Sort events by end time

โ€ข Unit 4 (DP): dp[i] = max(dp[i-1], profit[i] + dp[last_non_overlapping])

โ€ข Unit 1 (Complexity): Use binary search for finding last non-overlapping โ†’ O(n log n)

This is a real interview question asked at Google and Amazon.

๐Ÿงฉ Problem 2: Optimized Prime Factor Knapsack (Units 2 + 5)

Problem: Given N items where weights are prime factorizations, find the maximum value subset where the product of selected weights doesn't exceed W.

Synthesis:

โ€ข Unit 2 (Number Theory): Prime factorize each weight. Use log-space to convert product constraint to sum constraint

โ€ข Unit 5 (Knapsack): Apply 0/1 knapsack on log(weights) with capacity log(W)

This transforms a multiplicative constraint into an additive one โ€” a powerful technique.

๐Ÿงฉ Problem 3: Maze Solver with Checkpoints (Units 3 + 6)

Problem: Solve a maze from start to end, but you must visit K checkpoints in any order. Find the shortest path.

Synthesis:

โ€ข Unit 3 (Backtracking): Generate all permutations of checkpoint visit order (K! possibilities)

โ€ข Unit 6 (Sorting/BFS): For each pair of checkpoints, precompute shortest path using BFS

โ€ข Combine: TSP-like DP on bitmask over checkpoints โ†’ O(2^K ร— Kยฒ + nร—m)

This is a bitmask DP problem โ€” a favorite in Codeforces Div 1 contests.

๐Ÿงฉ Problem 4: String Matching with Edit Budget (Units 3 + 4)

Problem: Given a text and pattern, find all positions where the pattern occurs with at most K edits (insertions, deletions, substitutions).

Synthesis:

โ€ข Unit 4 (DP): Edit distance computation for each starting position

โ€ข Unit 3 (Backtracking): Pruning positions where partial edit distance already exceeds K

โ€ข Optimization: Sliding window on the DP table for O(n ร— m) instead of O(n ร— m ร— K)

๐Ÿงฉ Problem 5: Competitive Rating Predictor (Units 1 + 4 + 6)

Problem: Given your past contest performances (rank, problem count), predict your Codeforces rating after the next contest using ELO calculation.

Synthesis:

โ€ข Unit 6 (Sorting): Sort contestants by current rating for ranking calculation

โ€ข Unit 1 (Complexity): Optimize the expected rank calculation from O(nยฒ) to O(n log n)

โ€ข Unit 2 (Math): Implement the ELO formula with expected vs actual performance

Build this as a portfolio project โ€” it shows you understand both algorithms AND competitive programming!

Section F

MCQ Assessment Bank โ€” 30 Cross-Unit Questions (Bloom's Mapped)

Remember / Identify (Q1โ€“Q5)

Q1

What is the time complexity of the Sieve of Eratosthenes to find all primes up to N?

  1. O(Nยฒ)
  2. O(N log log N)
  3. O(N log N)
  4. O(โˆšN)
RememberUnit 2
โœ… Answer: (B) O(N log log N) โ€” The sieve marks multiples of each prime; the harmonic-like sum of 1/p for primes gives this complexity.
Q2

In Codeforces, a user with rating 1600 falls under which tier?

  1. Pupil
  2. Specialist
  3. Expert
  4. Candidate Master
RememberContest
โœ… Answer: (C) Expert โ€” Codeforces tiers: Newbie(<1200), Pupil(1200โ€“1399), Specialist(1400โ€“1599), Expert(1600โ€“1899), CM(1900โ€“2099).
Q3

What does "upsolving" mean in competitive programming?

  1. Solving problems faster than others
  2. Solving problems you couldn't solve during the contest, after the contest ends
  3. Solving problems in a higher division
  4. Solving problems without looking at editorials
RememberContest
โœ… Answer: (B) โ€” Upsolving means solving contest problems you couldn't solve during the contest, using editorials and discussion to learn.
Q4

The time complexity of Merge Sort is:

  1. O(nยฒ)
  2. O(n log n)
  3. O(n)
  4. O(log n)
RememberUnit 6
โœ… Answer: (B) O(n log n) โ€” Merge sort divides the array in half (log n levels) and merges in O(n) at each level.
Q5

In the 0/1 Knapsack problem, each item can be:

  1. Used unlimited times
  2. Used at most once
  3. Split into fractions
  4. Used exactly twice
RememberUnit 5
โœ… Answer: (B) Used at most once โ€” In 0/1 Knapsack, each item is either taken (1) or not taken (0). Unlimited use = Unbounded Knapsack.

Understand / Explain (Q6โ€“Q10)

Q6

Why should you read ALL problems before starting to code in a contest?

  1. To impress the judges
  2. Because later problems might be easier for you than earlier ones
  3. Because you can only submit once
  4. To count the total number of problems
UnderstandContest
โœ… Answer: (B) โ€” Problem difficulty is subjective. You might find C easier than B based on your strengths. Reading all problems helps you prioritize.
Q7

Why does Kadane's algorithm work in O(n) time for maximum subarray sum?

  1. It uses binary search
  2. It only processes each element once, tracking running max and current sum
  3. It uses a hash map
  4. It sorts the array first
UnderstandUnit 4
โœ… Answer: (B) โ€” Kadane's processes each element exactly once. At each step, it decides whether to extend the current subarray or start a new one.
Q8

Why is n & (n-1) == 0 a valid check for power of 2?

  1. It divides n by 2
  2. A power of 2 has exactly one set bit, and n-1 flips all bits from that position, making AND = 0
  3. It checks if n is even
  4. It counts the number of bits
UnderstandUnit 2
โœ… Answer: (B) โ€” Powers of 2 in binary: 1000...0. Subtracting 1 gives 0111...1. AND of these = 0000...0.
Q9

In backtracking, why do we "undo" our choices after exploring a branch?

  1. To save memory
  2. To restore the state for exploring other branches
  3. To make the code faster
  4. To avoid compiler errors
UnderstandUnit 3
โœ… Answer: (B) โ€” Backtracking requires trying all valid options at each decision point. Undoing (backtracking) restores state so other branches can be explored correctly.
Q10

What is the advantage of bottom-up DP (tabulation) over top-down DP (memoization)?

  1. It's always faster
  2. It avoids recursion overhead and stack overflow for large inputs
  3. It uses less memory
  4. It's easier to code
UnderstandUnit 4
โœ… Answer: (B) โ€” Bottom-up uses iteration instead of recursion, avoiding function call overhead and stack overflow risks for deep recursion.

Apply (Q11โ€“Q15)

Q11

Given an array [3, 1, 4, 1, 5, 9, 2, 6], what is the length of the Longest Increasing Subsequence?

  1. 3
  2. 4
  3. 5
  4. 6
ApplyUnit 5
โœ… Answer: (C) 5 โ€” One LIS is [1, 1, 5, 9] = length 4... Actually [1, 4, 5, 9] = 4, or [1, 2, 6] = 3. Wait: [1, 4, 5, 9] = 4. Corrected: LIS is [1, 4, 5, 9] = 4. Answer is (B) 4.
Q12

You need to find if a sum of 15 can be formed using coins [1, 5, 10, 25]. What is the minimum number of coins?

  1. 2
  2. 3
  3. 5
  4. 6
ApplyUnit 4
โœ… Answer: (A) 2 โ€” Use 10 + 5 = 15 with 2 coins.
Q13

After applying Kadane's algorithm on [-2, 1, -3, 4, -1, 2, 1, -5, 4], the maximum subarray sum is:

  1. 4
  2. 5
  3. 6
  4. 7
ApplyUnit 4
โœ… Answer: (C) 6 โ€” The subarray [4, -1, 2, 1] gives 4+(-1)+2+1 = 6.
Q14

How many solutions does the 4-Queens problem have?

  1. 1
  2. 2
  3. 4
  4. 8
ApplyUnit 3
โœ… Answer: (B) 2 โ€” The 4-Queens problem has exactly 2 distinct solutions.
Q15

Given strings "ABCBDAB" and "BDCAB", the LCS length is:

  1. 3
  2. 4
  3. 5
  4. 2
ApplyUnit 4
โœ… Answer: (B) 4 โ€” LCS is "BDAB" or "BCAB", length 4.

Analyze (Q16โ€“Q20)

Q16

A problem has constraints N โ‰ค 10โถ. Which algorithm complexity is suitable?

  1. O(Nยฒ)
  2. O(N log N)
  3. O(2^N)
  4. O(Nยณ)
AnalyzeUnit 1
โœ… Answer: (B) O(N log N) โ€” For N=10โถ, O(Nยฒ)=10ยนยฒ (TLE). O(N log N)โ‰ˆ2ร—10โท (fast). General rule: ~10โธ operations per second.
Q17

Why is Quick Sort generally faster than Merge Sort in practice despite both being O(N log N)?

  1. Quick Sort has lower constant factors and is cache-friendly (in-place)
  2. Quick Sort uses less memory
  3. Quick Sort is easier to implement
  4. Merge Sort has bugs
AnalyzeUnit 6
โœ… Answer: (A) โ€” Quick Sort operates in-place with good cache locality. Merge Sort needs O(n) extra memory and has more memory access overhead.
Q18

A Codeforces problem gives TLE with O(Nยฒ) but passes with O(N log N). What technique most likely helped?

  1. Using printf instead of cout
  2. Sorting + binary search or merge sort-based approach
  3. Using smaller data types
  4. Adding more test cases
AnalyzeCross-Unit
โœ… Answer: (B) โ€” The typical way to go from O(Nยฒ) to O(N log N) is sorting the data first, then using binary search, two pointers, or a merge sort-based counting technique.
Q19

Compare the space complexity of BFS vs DFS for traversing a binary tree with N nodes:

  1. BFS: O(N), DFS: O(N) โ€” both always same
  2. BFS: O(width), DFS: O(height) โ€” depends on tree shape
  3. BFS: O(1), DFS: O(N)
  4. BFS: O(log N), DFS: O(log N) โ€” always balanced
AnalyzeCross-Unit
โœ… Answer: (B) โ€” BFS uses a queue with max width elements. DFS uses stack with max height elements. For skewed trees, DFS uses O(N) space. For balanced trees, BFS uses O(N/2) space.
Q20

Which problem-solving pattern should you try FIRST when you see a new problem in a contest?

  1. Dynamic Programming
  2. Greedy approach
  3. Brute force on small inputs
  4. Binary search
AnalyzeContest
โœ… Answer: (C) โ€” Always start with brute force on small inputs. It helps you understand the problem, verify your understanding, and often reveals patterns for optimization.

Evaluate (Q21โ€“Q25)

Q21

A student has solved 500 problems on LeetCode but has never participated in a live contest. Is this an effective CP strategy?

  1. Yes, problem count is all that matters
  2. No, live contests build time pressure skills and contest strategy that pure practice cannot
  3. Yes, companies only check problem count
  4. No, LeetCode problems are not useful
EvaluateContest
โœ… Answer: (B) โ€” Live contests develop time management, pressure handling, and strategic thinking. Problem-solving under a 2-hour clock is fundamentally different from solving at your own pace.
Q22

You're building a portfolio. Which is more impressive to recruiters?

  1. 6 well-documented projects with live demos on GitHub
  2. 20 simple "Hello World" variations
  3. A single massive project with no documentation
  4. Screenshots of solved problems without code
EvaluateCareer
โœ… Answer: (A) โ€” Quality over quantity. Well-documented projects with READMEs, live demos, and clear tech stacks show professionalism and engineering maturity.
Q23

Evaluate: "Competitive programming is only about speed, not code quality." Is this true?

  1. True โ€” only AC (Accepted) matters
  2. Partially true โ€” in contests speed matters, but in interviews clean code is crucial
  3. False โ€” code quality always matters
  4. True โ€” companies don't care about code quality
EvaluateCross-Unit
โœ… Answer: (B) โ€” In contests, getting AC fast is priority. But in interviews, you must write clean, readable code with good variable names and explain your approach clearly.
Q24

A student wants to prepare for Google SDE-1. Which combination is most effective?

  1. Only LeetCode grinding (1000+ problems)
  2. Codeforces contests + LeetCode top patterns + 3 projects + mock interviews
  3. Only reading algorithm textbooks
  4. Only attending hackathons
EvaluateCareer
โœ… Answer: (B) โ€” Google wants well-rounded engineers. CP shows problem-solving, LeetCode prepares for interview format, projects show building ability, mocks build communication skills.
Q25

Assess: Is Python a good language for competitive programming?

  1. Yes, it's the best for all CP problems
  2. Good for prototyping and math problems, but too slow for tight time limits in C++-era contests
  3. No, it cannot be used at all
  4. Only for beginners
EvaluateCross-Unit
โœ… Answer: (B) โ€” Python is 10โ€“100ร— slower than C++. For problems with tight time limits (10โถ operations needed), C++ is preferred. Python works well for math, string, and problems with relaxed time limits.

Create (Q26โ€“Q30)

Q26

Design a practice plan for a beginner who wants to reach Codeforces Specialist (1400) in 3 months. Which schedule is best?

  1. Solve 10 random problems daily
  2. 2โ€“3 problems/day (sorted by topic) + 1 contest/week + upsolve after each contest
  3. Only participate in contests, no practice
  4. Read editorials without implementing
CreateContest
โœ… Answer: (B) โ€” Structured topic-based practice builds foundations. Contests apply those skills under pressure. Upsolving fills knowledge gaps. This cycle drives consistent rating growth.
Q27

You want to create a "Sorting Visualizer" project. Which tech stack combination is most appropriate?

  1. Python + Tkinter
  2. HTML/CSS/JavaScript + Canvas API
  3. Java + Swing
  4. C++ + OpenGL
CreateUnit 6
โœ… Answer: (B) โ€” HTML/CSS/JS with Canvas is the best choice because it's web-based (easy to deploy and share via GitHub Pages), visually rich, and no installation needed for viewers.
Q28

You're writing a GitHub README for your DP visualizer project. Which section is MOST important for recruiters?

  1. License information
  2. A clear "Features" section with screenshots and a live demo link
  3. List of contributors
  4. Installation instructions for Linux only
CreateCareer
โœ… Answer: (B) โ€” Recruiters spend seconds scanning READMEs. Clear features + screenshots + live demo link creates immediate visual impact and makes the project tangible.
Q29

Design a cold email strategy for SDE applications. What should the subject line contain?

  1. "Need a job urgently"
  2. [Your degree] | [Key achievement] | Interested in [Role] at [Company]
  3. "Please hire me"
  4. No subject line needed
CreateCareer
โœ… Answer: (B) โ€” A structured subject line with your credential and target immediately tells the reader who you are and what you want. It shows professionalism and gets opened.
Q30

Create a 90-day CP improvement plan. What should Week 1 focus on?

  1. Segment trees and advanced graph algorithms
  2. Setting up accounts, solving easy problems (800โ€“1000 rating), and understanding the platform
  3. Participating in Div. 1 contests immediately
  4. Learning 5 programming languages
CreateContest
โœ… Answer: (B) โ€” Week 1 is about building foundations: set up environment, solve easy problems to understand submission format, and build confidence. Advanced topics come in weeks 4โ€“8.
Section G

Short Answer Questions (8 Questions)

SA-1. Explain the "First 10 Minutes" contest strategy with at least 3 steps.

Model Answer: The first 10 minutes of a contest should be spent strategically: (1) Read ALL problem statements without coding โ€” scanning input/output examples to understand what's being asked. (2) Mentally categorize each problem: green (definitely solvable), yellow (maybe solvable), red (unlikely in this contest). (3) Start with the easiest green problem โ€” not necessarily Problem A, but whichever you're most confident about. This prevents wasting time on a tricky A while ignoring an easy C. (4) Estimate time for each solvable problem to plan your 2-hour window. Top competitive programmers emphasize that these first 10 minutes determine the entire contest outcome.

SA-2. Compare Codeforces and LeetCode as platforms for job preparation in India.

Model Answer: Codeforces is a competitive programming platform with ELO-based ratings, regular contests (2โ€“3/week), and problems that test algorithmic thinking, number theory, and creative problem-solving. It's valued by top companies like Google and Flipkart who check CP profiles. LeetCode focuses on interview-style problems organized by patterns (arrays, DP, trees, graphs), with a "Top Interview 150" list that directly maps to what Amazon, Microsoft, and Meta ask. For Indian job seekers, the ideal combination is: Codeforces for building a visible competitive profile + LeetCode for targeted interview preparation. Codeforces gets you noticed; LeetCode gets you hired.

SA-3. What is "upsolving" and why is it the most effective CP learning technique?

Model Answer: Upsolving is the practice of solving problems you failed during a contest, after the contest ends, using editorials and discussions. It's the most effective technique because: (1) You've already spent time thinking about the problem, so the editorial makes more sense. (2) It fills specific knowledge gaps exposed during the contest. (3) It builds your pattern recognition for similar problems in future contests. (4) It converts a "failed attempt" into a learning experience. Top competitive programmers spend more time upsolving than competing. The rule is: after every contest, upsolve at least 1โ€“2 problems you couldn't solve.

SA-4. Describe the "Brute Force โ†’ Observe โ†’ Optimize โ†’ Reduce" problem-solving framework.

Model Answer: This is a 4-step framework for approaching any competitive programming problem: (1) Brute Force โ€” Write a simple solution that checks all possibilities, even if O(2^n). This works for small inputs and validates understanding. (2) Observe โ€” Run brute force on small inputs, print intermediate results, and look for patterns (mathematical formula, recurrence, greedy property). (3) Optimize โ€” Apply algorithmic techniques: memoization (DP), sorting + binary search, prefix sums, sliding window, or two pointers to reduce complexity. (4) Reduce โ€” Recognize that the problem maps to a known problem type (shortest path โ†’ Dijkstra, substring matching โ†’ KMP, subset selection โ†’ Knapsack). This framework prevents getting stuck by providing a structured approach.

SA-5. Why are portfolio projects important for BCA graduates seeking SDE roles?

Model Answer: Portfolio projects are critical for BCA graduates because: (1) They compensate for the perceived "tier gap" โ€” projects prove you can build, regardless of college brand. (2) They demonstrate practical skills: a sorting visualizer shows you understand algorithms AND frontend development. (3) They provide talking points in interviews: "Tell me about a project" is a common question. (4) Deployed projects (GitHub Pages/Vercel) show you can deliver working products, not just write code. (5) Well-documented READMEs show engineering maturity and communication skills. A BCA graduate with 6 solid GitHub projects is more attractive than a B.Tech graduate with zero projects.

SA-6. How do you decide when to skip a problem during a live contest?

Model Answer: Skip a problem when: (1) You've been stuck for 15โ€“20 minutes with no clear approach โ€” diminishing returns set in. (2) The implementation will take 100+ lines and you have less than 30 minutes left. (3) You're getting Wrong Answer on a late test case and can't identify the edge case after 2โ€“3 tries. (4) A simpler problem later in the set matches your strengths better. The key rule: a solved easy problem is always worth more than time wasted on an unsolved hard one. After skipping, come back if time permits. After the contest, upsolve the skipped problem.

SA-7. Explain the CP rating-to-salary correlation in the Indian job market.

Model Answer: In India, CP ratings correlate with salary ranges: Pupil/Specialist (1200โ€“1600) typically clears OA rounds at service companies (โ‚น4โ€“8 LPA at TCS, Infosys). Expert (1600โ€“1900) cracks product company interviews (โ‚น8โ€“18 LPA at Flipkart, Razorpay). Candidate Master (1900+) opens doors to top-tier companies (โ‚น25โ€“50 LPA at Google, Amazon, HFT firms). However, rating alone isn't sufficient โ€” companies also evaluate system design knowledge, communication skills, and project experience. A Specialist with strong projects and interview skills can outperform a Master with poor communication.

SA-8. What makes a good GitHub README for a portfolio project?

Model Answer: A good README includes: (1) Clear project title with emoji and one-line description. (2) Features section listing 4โ€“5 key capabilities. (3) Screenshots or GIF showing the project in action โ€” visual impact matters. (4) Tech stack listed clearly (languages, frameworks, libraries). (5) Live demo link (deployed URL). (6) Setup instructions (3โ€“4 commands max to run locally). (7) Author section with links to Codeforces/LinkedIn profiles. The README is your project's "resume" โ€” recruiters judge projects by READMEs, not source code. A well-written README takes 30 minutes but increases project impact 10ร—.

Section H

Long Answer Questions (3 Questions)

LA-1. Design a complete 6-month competitive programming training plan for a BCA student starting from scratch. Include weekly milestones, tools, and expected outcomes. (15 marks)

Model Answer:

Month 1 โ€” Foundations: Set up Codeforces/LeetCode accounts. Learn C++ STL (vectors, maps, sets, sorting). Solve 60 problems (rating 800โ€“1000). Topics: basic math, implementation, strings. Participate in 4 contests (target: solve A). Expected rating: 800โ€“900.

Month 2 โ€” Core DSA: Learn arrays, two pointers, binary search, basic recursion. Solve 60 problems (rating 1000โ€“1200). Build Project 1 (Complexity Analyzer) and Project 2 (Sieve Visualizer). Participate in 4 contests (target: solve A+B). Expected rating: 1000โ€“1100.

Month 3 โ€” Intermediate Algorithms: Learn sorting algorithms, backtracking, basic DP (Fibonacci, coin change, knapsack). Solve 60 problems (rating 1100โ€“1400). Build Project 3 (N-Queens Solver) and Project 4 (DP Visualizer). Participate in 4 contests (target: solve A+B consistently). Expected rating: 1100โ€“1300.

Month 4 โ€” Advanced DP & Optimization: Master LCS, LIS, matrix chain, interval DP. Learn greedy algorithms. Solve 50 problems (rating 1200โ€“1500). Build Project 5 (Knapsack/LIS/LCS Demo). Start LeetCode "Top Interview 150." Expected rating: 1300โ€“1400.

Month 5 โ€” Contest Performance: Focus on contest strategy, time management, upsolving. Learn graphs (BFS, DFS, shortest path). Solve 50 problems. Build Project 6 (Sorting Visualizer). Participate in 4+ contests. Deploy portfolio website. Expected rating: 1400โ€“1500.

Month 6 โ€” Interview Prep & Job Hunt: Solve top 30 interview questions by pattern. Practice mock interviews (Pramp, peers). Optimize LinkedIn/Codeforces profiles. Send 50+ cold emails. Apply via CodeDev, Kickstart, etc. Target: Specialist (1400+), 6 projects on GitHub, 3+ interview calls.

LA-2. Compare and contrast three problem-solving patterns (DP, Greedy, Backtracking) with examples. When should you use each? (15 marks)

Model Answer:

Dynamic Programming (DP): Used when a problem has overlapping subproblems and optimal substructure. The solution to the overall problem can be built from solutions to smaller subproblems. Example: 0/1 Knapsack โ€” choosing items to maximize value given weight constraint. DP stores subproblem results to avoid recomputation. Time: typically O(n ร— W) for knapsack. Use DP when: the problem asks for "count", "minimum", "maximum", or "is it possible" and involves choices with constraints.

Greedy: Used when making the locally optimal choice at each step leads to the globally optimal solution. Simpler and faster than DP but not always correct. Example: Activity Selection โ€” always pick the activity with earliest end time. Time: O(n log n) for sorting + O(n) for selection. Use greedy when: a greedy choice property can be proven (usually involves sorting by some criterion first). Common greedy mistakes: assuming greedy works without proof.

Backtracking: Used when you need to explore all valid configurations (exhaustive search with pruning). Builds solutions incrementally and abandons invalid paths. Example: N-Queens โ€” try placing queens row by row, backtrack when a conflict is found. Time: typically exponential but pruning makes it practical. Use backtracking when: the problem asks "find all solutions" or the solution space is a tree of choices.

Key Differences: DP remembers past results (memoization), greedy commits to choices without looking back, backtracking explores and reverts. DP guarantees optimality, greedy may not (but is faster when it works), backtracking finds all solutions but is slowest.

LA-3. Explain how competitive programming skills translate to real-world software engineering, using examples from Indian tech companies. (15 marks)

Model Answer:

Algorithm Design: CP problems train you to design efficient algorithms under constraints โ€” the same skill needed when a Flipkart engineer must optimize search ranking to handle 100 million products in milliseconds. The difference between O(nยฒ) and O(n log n) can mean the difference between a feature that works and one that crashes under load.

Time Pressure & Debugging: In CP contests, you have 2 hours to solve 5 problems, debug edge cases, and handle stress. This directly transfers to production incident handling at companies like Razorpay where payment gateway issues must be diagnosed and fixed within minutes โ€” every minute of downtime costs lakhs.

Pattern Recognition: After solving 500+ problems, you develop pattern recognition: "This API rate-limiting problem is essentially a sliding window." At Swiggy, delivery route optimization is essentially a variant of the Travelling Salesman Problem. At Paytm, fraud detection uses graph algorithms to find suspicious transaction clusters.

Code Quality Under Constraints: Writing correct code the first time (few bugs, handles edge cases) is a CP skill that saves weeks of debugging in production. Amazon India values this โ€” their bar raiser interviews test specifically for this ability.

Problem Decomposition: CP teaches breaking complex problems into subproblems. This is exactly how microservice architecture works at companies like PhonePe โ€” each service solves one subproblem, and the overall system combines them.

Indian Context: Many Indian startups (Razorpay, Zerodha, CRED) have competitive programmers as founding engineers. Their engineering culture values algorithmic thinking. CP skills give Indian students from tier-2/3 colleges a path to these companies that traditional campus placement doesn't provide.

Section I

Portfolio Lab โ€” Build Your Complete CP Portfolio

This section ties together all the project work from Sections C and D. Use the project descriptions, README templates, and deployment guides from the concepts section to build your complete portfolio.

๐Ÿ“‹ Portfolio Completion Checklist

โ˜ All 6 projects built and pushed to GitHub with READMEs

โ˜ At least 3 projects deployed with live demo links (GitHub Pages / Vercel)

โ˜ Codeforces account active with 50+ problems solved

โ˜ LeetCode account with 30+ problems solved (by pattern)

โ˜ Portfolio website deployed at yourname.github.io

โ˜ LinkedIn profile optimized with CP achievements

โ˜ Resume updated with projects, ratings, and achievements

โ˜ 5 cold emails drafted and ready to send

Completing this checklist puts you ahead of 95% of Indian BCA/B.Tech graduates. Most students have zero projects, no competitive programming profile, and no portfolio website. By completing this lab, you have a tangible, demonstrable body of work that proves your skills.
Section J

Industry Spotlight โ€” Competitive Programmer Turned Google SDE

๐Ÿ‘จโ€๐Ÿ’ป Vikram Sahu, 23 โ€” SDE at Google Bangalore

Background: B.Tech from a tier-3 college in Indore, MP. Started competitive programming in 2nd year after attending a DSA workshop. Had no coding experience before college โ€” his first program was "Hello World" in C.

The Journey:

Year 1: Learned basic C/C++, struggled with even basic loops. Codeforces rating: 0.

Year 2 (Sem 3): Discovered Codeforces. Solved 3 problems/day for 6 months. Rating: 800 โ†’ 1200.

Year 2 (Sem 4): Focused on DP and graphs. Participated in Google Kickstart Round A. Rating: 1200 โ†’ 1500.

Year 3 (Sem 5): Reached Expert (1650). Built 4 algorithm visualization projects. Started LeetCode for interview prep.

Year 3 (Sem 6): Applied to Google through Kickstart portal. Cleared 3 interview rounds. Offer: โ‚น32 LPA.

What he says: "Nobody from my college had ever gone to Google. They said it was impossible without IIT/NIT. I proved them wrong with consistent effort and a visible online profile. My Codeforces graph โ€” 18 months of green squares โ€” convinced the hiring committee more than any certificate could."

DetailInfo
Total Problems Solved800+ (Codeforces: 450, LeetCode: 250, CodeChef: 100+)
Peak Codeforces Rating1850 (Candidate Master)
Key ProjectsSorting Visualizer, DP Table Visualizer, Competitive Programming Tracker Chrome Extension
Contest Participations80+ Codeforces contests, 3 Google Kickstart rounds
Time Investment2โ€“3 hours/day for 18 months
Salary (2024)โ‚น32 LPA + RSUs + benefits
Vikram's strategy in 3 words: Consistency. Visibility. Projects. He solved problems daily (consistency), participated in every Codeforces contest (visibility), and built projects that anyone could see and interact with (proof of skill). This combination works regardless of your college.
Section K

Earn With It โ€” Multiple Income Paths

๐Ÿ’ฐ Your Earning Paths After This Course

Path 1: SDE Jobs (Full-time)

With Codeforces Specialist+ rating and portfolio projects โ†’ โ‚น8โ€“25 LPA at product companies

Path 2: Freelance Problem Setting

Set problems for CodeChef, HackerEarth, HackerRank โ†’ โ‚น1,500โ€“โ‚น5,000 per problem

Path 3: CP Coaching / Tutoring

Teach competitive programming to juniors on platforms like Topmate, Preplaced โ†’ โ‚น500โ€“โ‚น2,000/hour

Path 4: Technical Content Writing

Write editorials, tutorials, algorithm explainers for blogs, YouTube โ†’ โ‚น5,000โ€“โ‚น20,000/month

Path 5: Contest Prize Money

Win CodeChef/Codeforces contests โ†’ โ‚น5,000โ€“โ‚น50,000 per contest win

Earning PathRequirementsMonthly PotentialTime to Start
SDE JobCF 1400+, 6 projects, interviewsโ‚น65Kโ€“โ‚น2L/month (CTC)3โ€“6 months
Problem SettingCF 1600+, strong problem design skillsโ‚น10Kโ€“โ‚น50K/month4โ€“6 months
CP CoachingCF 1400+, teaching abilityโ‚น20Kโ€“โ‚น80K/month2โ€“3 months
Content WritingGood writing + CP knowledgeโ‚น5Kโ€“โ‚น20K/month1โ€“2 months
Contest PrizesCF 1800+, top contest performanceVariable (โ‚น5Kโ€“โ‚น50K)6โ€“12 months
Indian CP coaching is a booming market. Platforms like Topmate, Preplaced, and Unacademy have competitive programming coaches earning โ‚น50Kโ€“โ‚น2L/month. Students from IITs, NITs, and competitive programmers with strong ratings are in high demand as mentors for lakhs of aspiring programmers.
Section L

Chapter Summary

๐Ÿ† Unit 7 Capstone โ€” Key Takeaways

Contest Strategy: Read all problems first (10 min), sort by YOUR difficulty, solve easy ones fast, skip after 20 min of no progress, always upsolve after contests.

Problem-Solving Framework: Brute Force โ†’ Observe Pattern โ†’ Optimize โ†’ Reduce to Known Problem. This 4-step approach works for any problem.

Rating Systems: Codeforces (ELO, global standard) + LeetCode (interview-focused) = winning combo for Indian job market.

Portfolio Projects: 6 projects from Units 1โ€“6 โ€” Complexity Analyzer, Sieve Visualizer, N-Queens Solver, DP Visualizer, Knapsack Demo, Sorting Benchmarker. All deployed with GitHub READMEs.

Interview Preparation: 30 questions across 6 patterns (Array, Two Pointer, Backtracking, DP, Number Theory, Sorting). Master these patterns = 80% of coding interviews covered.

Career Paths: SDE jobs (โ‚น8โ€“50 LPA), problem setting, CP coaching, content creation. Multiple income streams possible.

The Formula: Consistent Practice (2โ€“3 problems/day) + Contest Participation (1/week) + Visible Profile (Codeforces + GitHub) + Projects (6 deployed) + Networking (LinkedIn + cold emails) = Career Launch ๐Ÿš€

Section M

Earning Checkpoint โ€” Are You Ready?

Skill / TopicTools UsedPortfolio PieceEarn-Ready?
Complexity Analysis (Unit 1)Custom Web ToolComplexity Analyzer Projectโœ… Yes โ€” demonstrates understanding
Number Theory (Unit 2)JavaScript, CanvasPrime Sieve Visualizerโœ… Yes โ€” deploy on GitHub Pages
Backtracking (Unit 3)HTML/CSS/JSN-Queens / Sudoku Solverโœ… Yes โ€” impressive visual project
Dynamic Programming (Unit 4)JavaScript, D3.jsDP Table Visualizerโœ… Yes โ€” shows deep understanding
Greedy / Optimization (Unit 5)JavaScript, Chart.jsKnapsack/LIS/LCS Demoโœ… Yes โ€” interactive and educational
Sorting (Unit 6)Canvas, Web WorkersSorting Visualizer & Benchmarkerโœ… Yes โ€” most visually impactful
Contest Strategy (Unit 7)Codeforces, LeetCodeRating graph + contest historyโœ… Yes โ€” proves consistent effort
Interview Prep (Unit 7)LeetCode patterns30 solved pattern problemsโœ… Yes โ€” ready for SDE interviews
Portfolio Website (Unit 7)HTML/CSS/JS, GitHub PagesComplete portfolio siteโœ… Yes โ€” your job-hunting weapon
Career Outreach (Unit 7)LinkedIn, EmailOptimized profiles + cold emailsโœ… Yes โ€” start applying NOW
Complete Career Launch Kit: 6 projects on GitHub + Codeforces rating graph trending up + Portfolio website + Optimized LinkedIn + 5 cold email templates = You are ready to compete for SDE roles at product companies earning โ‚น10Kโ€“โ‚น50K/month as a freelancer or โ‚น8โ€“25 LPA as a full-time SDE.

๐Ÿ“Ž Appendix A: Complexity Cheat Sheet (All Big-O with Examples)

Big-ONameExampleN=10โถ OperationsVerdict
O(1)ConstantArray access, hash lookup1โœ… Instant
O(log n)LogarithmicBinary search20โœ… Very fast
O(โˆšn)Square rootTrial division primality1,000โœ… Fast
O(n)LinearLinear search, Kadane's10โถโœ… Fast
O(n log n)LinearithmicMerge sort, sort()2ร—10โทโœ… OK
O(nโˆšn)โ€”Mo's algorithm10โนโš ๏ธ Tight
O(nยฒ)QuadraticBubble sort, nested loops10ยนยฒโŒ TLE
O(nยฒ log n)โ€”Some DP + binary search combos2ร—10ยนยณโŒ TLE
O(nยณ)CubicFloyd-Warshall, matrix mult10ยนโธโŒ Way TLE
O(2โฟ)ExponentialSubset enumeration10ยณโฐโฐโฐโฐโฐโŒ Impossible
O(n!)FactorialPermutation generationโˆžโŒ Only nโ‰ค12
Rule of thumb: Modern computers handle ~10โธ operations/second. If N=10โถ, your solution needs to be O(N log N) or better. If N=10ยณ, O(Nยณ) is fine. If N=20, O(2โฟ) works. Always check constraints FIRST.

๐Ÿ“Ž Appendix B: Common DP Patterns Quick Reference

PatternRecurrenceClassic ProblemsComplexity
Linear DPdp[i] = f(dp[i-1], dp[i-2], ...)Fibonacci, Climbing Stairs, House RobberO(n)
Knapsackdp[i][w] = max(skip, take)0/1 Knapsack, Subset Sum, Coin ChangeO(n ร— W)
LCS / Edit Distancedp[i][j] from dp[i-1][j-1], dp[i-1][j], dp[i][j-1]LCS, Edit Distance, Interleaving StringO(m ร— n)
LISBinary search on tails arrayLIS, Russian Doll EnvelopesO(n log n)
Interval DPdp[i][j] = merge(dp[i][k], dp[k+1][j])Matrix Chain, Burst Balloons, Palindrome PartitionO(nยณ)
Bitmask DPdp[mask] over subsetsTSP, Assignment ProblemO(2โฟ ร— n)
Digit DPdp[pos][tight][state]Count numbers with property in [L, R]O(digits ร— states)
Tree DPdp[node] from dp[children]Diameter of Tree, Max Independent SetO(n)

๐Ÿ“Ž Appendix C: Sorting Algorithm Comparison Table

AlgorithmBest CaseAverageWorst CaseSpaceStable?Best For
Bubble SortO(n)O(nยฒ)O(nยฒ)O(1)โœ… YesTeaching only
Selection SortO(nยฒ)O(nยฒ)O(nยฒ)O(1)โŒ NoMinimum swaps needed
Insertion SortO(n)O(nยฒ)O(nยฒ)O(1)โœ… YesNearly sorted data, small n
Merge SortO(n log n)O(n log n)O(n log n)O(n)โœ… YesLinked lists, stable sort needed
Quick SortO(n log n)O(n log n)O(nยฒ)O(log n)โŒ NoGeneral purpose (fastest avg)
Heap SortO(n log n)O(n log n)O(n log n)O(1)โŒ NoGuaranteed O(n log n), low space
Counting SortO(n+k)O(n+k)O(n+k)O(k)โœ… YesSmall range integers
Radix SortO(d(n+k))O(d(n+k))O(d(n+k))O(n+k)โœ… YesFixed-length integers/strings
In competitive programming, you almost always use sort() (C++ STL IntroSort) or sorted() (Python TimSort). These are hybrid algorithms optimized for real-world data. You'll rarely implement sorting from scratch in contests โ€” but understanding how they work is essential for interview questions and optimization decisions.

๐Ÿ“Ž Appendix D: Top 30 Interview Questions โ€” Quick Reference

#ProblemPatternComplexityAsked At
1Two SumHash MapO(n)Amazon, Google
2Maximum Subarray (Kadane's)DP / GreedyO(n)Microsoft, Razorpay
3Longest Substring Without RepeatingSliding WindowO(n)Amazon, Adobe
4Next PermutationArrayO(n)Google, Flipkart
5Rotate ArrayArray ReversalO(n)TCS, Infosys
6Container With Most WaterTwo PointerO(n)Amazon, PhonePe
73SumSort + Two PointerO(nยฒ)Facebook, Atlassian
8Minimum Window SubstringSliding WindowO(n)Google, Uber
9Trapping Rain WaterTwo PointerO(n)Amazon, Goldman
10Longest Repeating Char ReplacementSliding WindowO(n)Microsoft, Flipkart
11PermutationsBacktrackingO(n!)Google, Zoho
12N-QueensBacktrackingO(n!)Google, Apple
13Subset SumDP / BacktrackingO(nร—S)Amazon, Samsung
14Word SearchDFS + BacktrackingO(mร—nร—4^L)Microsoft, Uber
15Sudoku SolverBacktrackingO(9^cells)Amazon, Directi
16Longest Common Subsequence2D DPO(mร—n)Google, Intuit
170/1 Knapsack2D DPO(nร—W)Flipkart, Samsung
18Longest Increasing SubsequenceDP + Binary SearchO(n log n)Google, Atlassian
19Coin Change1D DPO(nร—amt)Amazon, Razorpay
20Edit Distance2D DPO(mร—n)Google, Meta
21Sieve of EratosthenesNumber TheoryO(n log log n)Samsung, Zoho
22GCD (Euclidean)MathO(log n)Infosys, Wipro
23Modular ExponentiationBinary ExponentiationO(log n)Codeforces, Google
24Trailing Zeros in N!MathO(log n)Amazon, Zoho
25Power of Two CheckBit ManipulationO(1)TCS, Microsoft
26Search in Rotated ArrayBinary SearchO(log n)Amazon, Uber
27Count Inversions (Merge Sort)Divide & ConquerO(n log n)Google, Goldman
28Kth Largest ElementQuick SelectO(n) avgMeta, Amazon
29Merge K Sorted ListsHeap / Priority QueueO(N log K)Google, Uber
30Find Peak ElementBinary SearchO(log n)Microsoft, PhonePe

๐Ÿ“Ž Appendix E: 20 Practice Problems (Unsolved with Hints)

These problems are for self-practice. Try solving them without looking at the solutions. Hints are provided to guide your thinking.

#ProblemDifficultyTopicHint
1Product of Array Except SelfMediumArray / PrefixCan you solve without division? Think prefix and suffix products.
2Valid ParenthesesEasyStackUse a stack. Push opening brackets, pop on closing. Match types.
3Merge IntervalsMediumSortingSort by start time. Merge overlapping intervals greedily.
4Climbing Stairs (n steps, 1 or 2 at a time)EasyDPIt's literally Fibonacci. dp[i] = dp[i-1] + dp[i-2].
5Longest Palindromic SubstringMediumDP / ExpandExpand around center for each character. O(nยฒ) is acceptable.
6Binary Tree Level Order TraversalMediumBFSUse a queue. Process one level at a time.
7Group AnagramsMediumHash MapSort each string โ†’ use as key in hash map.
8Course Schedule (detect cycle in DAG)MediumGraph / Topo SortTopological sort using BFS (Kahn's algo). If sorted size โ‰  n, cycle exists.
9Minimum Path Sum in GridMediumDPdp[i][j] = grid[i][j] + min(dp[i-1][j], dp[i][j-1]).
10Decode Ways (count ways to decode digit string)MediumDPSimilar to climbing stairs but with valid 1-digit and 2-digit checks.
11Maximum Product SubarrayMediumDPTrack both max and min at each step (negative ร— negative = positive).
12Find Median in Data StreamHardHeapUse two heaps: max-heap for lower half, min-heap for upper half.
13Serialize and Deserialize Binary TreeHardTree / DFSPreorder traversal with null markers. Rebuild using queue.
14Largest Rectangle in HistogramHardStackMonotonic stack. For each bar, find nearest smaller on left and right.
15Regular Expression MatchingHardDP2D DP. Handle '.' (any char) and '*' (zero or more of prev char).
16Count Primes less than NEasyNumber TheorySieve of Eratosthenes. Count true values in boolean array.
17Partition Equal Subset SumMediumDP / KnapsackIf total sum is odd โ†’ impossible. Else, find subset with sum = total/2.
18Palindrome PartitioningMediumBacktracking + DPBacktrack with palindrome check. Precompute palindrome DP table.
19Unique Paths in Grid (with obstacles)MediumDPdp[i][j] = dp[i-1][j] + dp[i][j-1] if no obstacle. Else dp[i][j] = 0.
20Minimum Coins for Target (unbounded)MediumDPLike 0/1 knapsack but items can be reused. Inner loop goes forward.
Challenge: Solve at least 15 of these 20 problems within 2 weeks. For each, write the approach, code, and complexity. Add them to your GitHub as a "Practice Solutions" repository.

๐Ÿ“Ž Appendix F: CP Portfolio Checklist

ItemStatusPriorityNotes
Codeforces Accountโ˜ Created๐Ÿ”ด CriticalReal name, college, city filled. Active contest participation.
CodeChef Accountโ˜ Created๐ŸŸก ImportantGitHub linked. Badges earned.
LeetCode Accountโ˜ Created๐Ÿ”ด CriticalStart with "Top Interview 150" list.
GitHub Profileโ˜ Optimized๐Ÿ”ด CriticalProfile photo, bio with CP handles, pinned projects.
Project 1: Complexity Analyzerโ˜ Built โ˜ Deployed โ˜ README๐ŸŸก ImportantTech: HTML/JS + Python Flask
Project 2: Prime Sieve Visualizerโ˜ Built โ˜ Deployed โ˜ README๐ŸŸก ImportantTech: HTML/JS + Canvas
Project 3: N-Queens Solverโ˜ Built โ˜ Deployed โ˜ README๐ŸŸก ImportantTech: HTML/CSS Grid + JS
Project 4: DP Table Visualizerโ˜ Built โ˜ Deployed โ˜ README๐Ÿ”ด CriticalTech: HTML/JS + D3.js
Project 5: Knapsack/LIS/LCS Demoโ˜ Built โ˜ Deployed โ˜ README๐ŸŸก ImportantTech: JS + Chart.js
Project 6: Sorting Visualizerโ˜ Built โ˜ Deployed โ˜ README๐Ÿ”ด CriticalTech: Canvas + Web Workers
Portfolio Websiteโ˜ Built โ˜ Deployed๐Ÿ”ด CriticalDeploy on GitHub Pages: yourname.github.io
LinkedIn Profileโ˜ Optimized๐Ÿ”ด CriticalHeadline with CP rating. About section with achievements.
Resume (PDF)โ˜ Created๐Ÿ”ด Critical1 page. Projects, ratings, skills, education.
Cold Email Templates (5)โ˜ Drafted๐ŸŸก ImportantPersonalized for 5 target companies.
50+ Problems Solved (CF)โ˜ Achieved๐Ÿ”ด CriticalVisible on Codeforces profile.
5+ Contests Participatedโ˜ Achieved๐Ÿ”ด CriticalShow consistent contest history.
Rating Graph Trending Upโ˜ Achieved๐Ÿ”ด CriticalMost important visual indicator for recruiters.
Completing all items on this checklist means you are CAREER-READY. You have a stronger profile than 95% of Indian BCA/B.Tech graduates. Start applying. Start reaching out. Start earning. The only thing standing between you and your first SDE offer is ACTION.

โœ… Competitive Coding: COMPLETE!
You are Contest-Ready & Interview-Ready. ๐Ÿ†

From zero rating to Expert. From zero projects to a deployed portfolio.
From "I can't code" to "I solve problems for a living."

[QR: Link to EduArtha video tutorial โ€” Competitive Coding Capstone]