juspay_elimination_and_partB_battle_plan.md

🔥 Juspay — Elimination Round & Hackathon Part B: Ultimate Battle Plan

Your interview could be Elimination only, Hackathon Part B only, or a Combined Final Round.
This document covers everything for all three scenarios. Treat it as your single source of truth.


📌 Table of Contents

  1. About the Combined Round Possibility
  2. The Single Most Important Thing: "Tree of Space"
  3. Elimination Round — Format & What to Expect
  4. All DSA Questions Actually Asked in Elimination Round
  5. Puzzles Actually Asked
  6. OOP / Design Questions Asked
  7. Hackathon Part B — What Actually Happens
  8. Everything Asked in Hackathon Part B
  9. Thread-Safety Deep Dive: Race Conditions You MUST Know
  10. CS Fundamentals Topics to Prepare
  11. Other Things to Prepare
  12. Master Checklist — Everything You Need to Do
  13. 2-Day Prep Priority Schedule

📢 About the Combined Round Possibility

[!IMPORTANT] Glassdoor's current process summary for Juspay lists the final stage explicitly as a "Final Combined Round" — Hackathon Part B plus a behavioral interview in one sitting. So a combined Elimination + Part B (or Part B + behavioral) session is a real, documented pattern, not just a possibility — expect the interviewer to pivot between technical deep-dive and softer questions without a clean break.

What this means for you:

  • Prepare for BOTH rounds simultaneously
  • Be ready for sudden context-switches (from coding to project discussion to OS questions)
  • Don't be surprised if you get puzzles + DSA + multithreading all in one sitting

🌳 The Single Most Important Thing: "Tree of Space"

Almost every account — 2021 through 2026 — centers on the same recurring problem. You've already solved it for Part A, but Part B is entirely a deep-dive on it, so know it cold.

The Setup

An M-ary tree of uniquely-named nodes (framed as a "world map"). Three operations, each taking a node name and a user ID:

Lock(X, uid)

Succeeds only if:

  • X itself is not locked
  • Every ancestor of X is unlocked
  • Every descendant of X is unlocked

Unlock(X, uid)

Succeeds only if:

  • X is locked
  • X was locked by the same uid

UpgradeLock(X, uid)

Lets uid "promote" a lock up to ancestor X. Succeeds only if:

  • X has >=1 locked descendant
  • All locked descendants belong to the same uid
  • X has no locked ancestor
  • On success: all descendant locks are released, X becomes locked instead

Complexity Targets (Explicitly Told to Optimize For)

OperationTarget Complexity
LockO(log_m N)
UnlockO(log_m N)
UpgradeO(k * log_m N) where k = number of locked descendants

Standard Working Approach

Each node tracks:

  • isLocked — boolean flag
  • lockedBy — the uid that locked it
  • ancestorsLocked counter — number of locked ancestors above this node
  • descendantsLocked counter (or a set of locked descendants)

Updated by walking up/down the tree on each operation.

Data Structure Design

Node { name: string parent: Node* children: List<Node*> isLocked: bool lockedBy: int (uid) lockedDescendants: Set<Node*> // or counter } HashMap<string, Node*> nameToNode; // O(1) node lookup by name

Complexity Analysis (Be Ready to Derive Verbally)

OperationStepsWhy
LockWalk up to root (O(height = log_m N)) to check ancestors + check descendants locked set is emptyHeight of M-ary tree with N nodes = log_m N
UnlockWalk up to root (O(height)) to update ancestors' descendant-locked setsSame ancestor walk
UpgradeWalk up (O(log_m N)) for ancestor check + iterate over k locked descendants releasing each (O(k * log_m N))Each descendant release requires its own ancestor walk

🎯 Elimination Round — Format & What to Expect

Format

  • Duration: 1-1.5 hours
  • Structure: Intro -> 20-45 min project/resume grilling -> 1-2 coding problems, sometimes a puzzle
  • Camera/screen-share is often required as an anti-cheating check
  • NOT a hackathon — this is a separate 1-on-1 interview

Consistent Theme

[!CAUTION] This round is really testing whether you can explain your Part A solution under cross-questioning. Several interviewers spend the first 30+ minutes re-deriving your Part A time/space complexity and probing why you made specific design choices, before giving you a fresh problem.

What Interviewers Probe About Your Part A

  • Walk through your solution line by line
  • Why did you choose this data structure over alternatives?
  • Derive the exact time complexity of Lock, Unlock, Upgrade
  • Derive the space complexity
  • What are the edge cases?
  • What happens if you receive 10,000 operations in sequence?
  • Why is your Upgrade O(k*log_m N) and not O(N)?

📝 All DSA Questions Actually Asked in Elimination Round

[!NOTE] These are real questions reported by candidates from 2022-2026 batches. Starred items appeared in multiple accounts.

Complete List with Solutions Approach

#ProblemKey ApproachLeetCode / Source
1Find the person with the highest score — Process q queries of (name, score); return whoever has the highest cumulative score at the end; ties go to whoever reached that max score firstHashMap for cumulative scores. Tie-break trap: replay the queries a second time to find who hit the final max firstCustom
2Job scheduling / minimize the maximum load — Given job times and k workers, distribute jobs to minimize the max total time any one worker getsGreedy + Min-Heap: sort descending, assign largest jobs first, keep adding remaining jobs to the currently-least-loaded workerSimilar to LeetCode 1834
3Open the Lock — 4-digit lock, avoid deadends, find minimum turnsBFS on state space. Explain brute force -> optimize to BFS -> complexity analysisLeetCode 752
4Basic Calculator — Evaluate expression with +, -, (, )Stack-based parsing. Handle nested parentheses, negationLeetCode 224
5Array/prefix-sum query problem — Array elements each need to "travel" to one of two shifting endpoints; each query redefines the endpoints; total travel cost per queryPrecomputed prefix sums of the base cost, adjusted per queryCustom
6Maximum Weight Node — In a directed functional graph (each node has at most 1 outgoing edge), find node with max sum of indices of nodes pointing to itArray of weights, iterate edges, find max. If tie: return highest indexGFG / Juspay OA
7Nearest Meeting Cell — Given two starting nodes in a functional graph, find nearest common reachable node minimizing total distanceTrace paths from both nodes, store distances, find min combined distance at common nodesGFG / Juspay OA
8Largest Sum Cycle — Find cycle with maximum sum of node indices in a functional graphDFS with cycle detection, track sum of nodes in cycle, keep maxGFG / Juspay OA
9Hashing + Backtracking problem — Hashmap-based problem paired with constraint-searchHashMap for state tracking + recursive backtracking with pruningCustom
10Reachability between two nodes — Can node A reach node B in a directed graph?BFS or DFS from A, check if B is visitedStandard Graph
11Shortest path between two nodesBFS (unweighted) or Dijkstra (weighted)Standard Graph
12Minimum vertex cut — Minimum set of people to remove to disconnect two nodesMax-flow min-cut conceptAdvanced Graph
13Word Ladder — Shortest transformation sequenceBFS on word graphLeetCode 127
14Level order traversal of a forestBFS with multiple rootsStandard Trees
15Depth with maximum nodes in a forestBFS level-order, count nodes per levelStandard Trees

OA-Specific Graph Problems (The "Juspay Trio")

These three appear in nearly every Juspay Online Assessment:

1. Maximum Weight Node -> O(N) time, O(N) space 2. Nearest Meeting Cell -> O(N) time, O(N) space 3. Largest Sum Cycle -> O(N) time, O(N) space

All three operate on a functional graph (each node has at most 1 outgoing edge — represented as an array edge[i] where edge[i] = -1 means no outgoing edge).

Additional LeetCode Problems to Practice

#ProblemTopicLeetCode #
1LRU CacheHashMap + DLL146
2Open the LockBFS752
3Basic CalculatorStack224
4Word LadderBFS127
5Coin ChangeDP322
6Lowest Common AncestorTrees236
7Sudoku SolverBacktracking37
8First Non-Repeating Character in StreamHashing + QueueGFG
9Minimum Swaps to SortGraph (Cycle Detection)GFG
10Detect Cycle in Directed GraphDFS207
11Ship Packages Within D DaysBinary Search on Answer1011
12Longest Subarray with K DistinctSliding Window340
13Merge Overlapping IntervalsSorting + Greedy56
14Kth Smallest in Sorted MatrixHeap / Binary Search378
15Max Depth of Binary TreeTrees104
16Level Order TraversalBFS102
17Search in Rotated Sorted ArrayBinary Search33
18Trapping Rain WaterTwo Pointers / Stack42
19Container With Most WaterTwo Pointers11
20N-QueensBacktracking51

🧩 Puzzles Actually Asked

[!NOTE] Puzzles appear in both Elimination rounds and System interviews. They test logical reasoning.

Repeatedly Asked Puzzles (High Priority)

#PuzzleWhat to Know
1Odd weight egg with a balance scale — Find the heavier/lighter egg from a set using minimum weighingsClassic: 8 balls -> 2 weighings (divide into 3 groups). 12 balls -> 3 weighings. Key: divide into thirds, not halves
2Two people agree to meet within an hour, each waits 10 minutes — What's the probability they meet?Geometric probability: Draw unit square, shade region where abs(x-y) <= 10/60. Answer: 1 - (50/60)^2 = 11/36 ~ 30.56%
3Burning rope problem — Measure 45 minutes with two ropes (each burns in 60 min, non-uniform rate)Light rope A from both ends + rope B from one end. A finishes at 30 min -> light B's other end -> B finishes at 45 min
4Egg drop problem — Minimum trials to find critical floorDP approach or mathematical: with k eggs and n floors, minimize worst-case trials
525 horses, 5 tracks — Minimum races to find top 3Answer: 7 races. Race 5 groups -> race winners -> eliminate based on results -> 1 more race
6Water jug problem — Measure specific amount with two jugsBFS on state space or GCD-based approach
7Monty Hall problemAlways switch. P(win by switching) = 2/3
8Birthday paradox23 people -> >50% chance of shared birthday

Weird/Unconventional Questions (Actually Asked!)

  • "How does a toilet flush work?" — Siphon mechanism
  • "Build a spaceship using Earth's resources"
  • "Build a steam engine from 8 components"
  • "Logical proof that height of binary tree = log(N) without using mathematical formulas" — At each level the number of nodes doubles, so the number of levels needed to accommodate N nodes is log2(N)
  • "Designing a garbage collector for a multi-threaded environment"
  • "Managing automated train crossing barricades"
  • Encryption/Decryption transformation puzzles

🏗️ OOP / Design Questions Asked

Open-Ended OOP Design Question Pattern

  • Interviewers explicitly say there's no fixed right answer
  • They're grading your reasoning, not a specific solution
  • Think: abstract classes, interfaces, adapter-pattern thinking

Actual Questions Reported

#QuestionWhat They're Looking For
1"How would you convert one class into another?"Adapter pattern, interface segregation, composition vs inheritance
2"Model different payment methods (Credit Card, UPI, Netbanking) using class hierarchies"Polymorphism, strategy pattern, open/closed principle
3"Design a Parking Lot System" (detailed — multi-storey, sections, car vs motorcycle slots)Full LLD with classes, APIs, edge cases
4"Design a payment gateway — transaction states, idempotency"State machine, idempotency keys, retry with exponential backoff

Key Design Patterns to Know

  • Adapter Pattern — Convert interface of a class to another (directly asked)
  • Strategy Pattern — Swap algorithms at runtime (e.g., different payment methods)
  • Observer Pattern — Event notification (e.g., transaction status updates)
  • Singleton — Thread-safe singleton (double-checked locking)
  • Factory Method — Create objects without specifying exact class

SOLID Principles (Be Ready to Explain Each with Examples)

  • S — Single Responsibility Principle
  • O — Open/Closed Principle
  • L — Liskov Substitution Principle
  • I — Interface Segregation Principle
  • D — Dependency Inversion Principle

💻 Hackathon Part B — What Actually Happens

[!CAUTION] This is the round people describe as the real gauntlet. Budget for a full day.

Format

  • You're assigned a mentor on Slack, sometimes paired with a Google Meet call
  • Duration is wildly inconsistent — reports range from ~6 hours to 9am-9pm to spanning two days, with one account describing a 17-hour stretch
  • Budget for a full day

The Flow (Step by Step)

Step 1: Re-explain your Part A solution and its exact time/space complexity, LIVE | Step 2: They push you to OPTIMIZE it further (e.g., moving from O(N) to O(log_m N) for lock/unlock) | Step 3: THE CORE TASK -> Make lock() (and ideally unlock/upgrade) THREAD-SAFE for multiple threads on a MULTI-CORE machine -- WITHOUT breaking parallelism (can't just wrap in one big lock) | Step 4: Name the EXACT RACE CONDITIONS yourself before fixing them | Step 5: Implement the fix -- from scratch, no libraries | Step 6: Trace specific thread interleavings by hand when asked | Step 7: Resume/project/tech-stack conversation + light OS/CN questions

The Hard Constraint (CRITICAL)

[!WARNING] No mutex, semaphore, synchronized, atomic built-ins, or condition variables allowed.

One 2026 account said binary semaphores specifically were allowed as a primitive to reason with — so the exact rule seems to vary slightly by interviewer, but "no ready-made concurrency primitives" is the norm.

Some interviewers ask you to build your own mutex from compiler intrinsics (__sync_lock_test_and_set) as a stepping stone, then take even that away.

The Psychological Trap (KNOW THIS!)

[!CAUTION] A recurring interview pattern: The interviewer will present a solution (sometimes your solution, sometimes one they suggest) and tell you it's thread-safe — and the test is whether you push back and find the bug yourself rather than accepting it.

One full transcript showed the interviewer explicitly walking through two interleaving scenarios (step-by-step context-switch traces) to prove a race condition existed in a solution they'd just claimed was safe.


🔍 Everything Asked in Hackathon Part B

Technical Questions You'll Face

#Question/TaskWhat to Prepare
1"Walk me through your Part A solution line by line"Be able to explain every design choice
2"What's the exact time complexity of Lock? Unlock? Upgrade? Derive it."Practice deriving without looking at code
3"Why is this O(log_m N) and not O(N)?"Understand M-ary tree height relationship
4"Optimize this from O(N) to O(log_m N)"Use descendant-locked counters/sets, parent pointers
5"Make this thread-safe without using any mutex/semaphore/atomic"Build locking from scratch using test-and-set or CAS
6"What are the race conditions in your lock() function?"Name them YOURSELF — see section below
7"Two threads lock the same node simultaneously — what happens?"Trace the interleaving step by step
8"Two threads lock different nodes that share a common ancestor — what happens?"The ancestor's descendant-locked counter has a race
9"Thread A does X, then context switch, thread B does Y — what state is the tree in?"Manual thread-interleaving trace
10"Is this solution thread-safe?" (they present a buggy solution)Push back and find the bug — DON'T just agree
11"Build your own mutex from compiler intrinsics"__sync_lock_test_and_set, spin-lock implementation
12"Now take away even that — how do you ensure atomicity?"Peterson's algorithm, Dekker's algorithm, Lamport's bakery

OS/CN Questions Asked Toward the End of Part B

#TopicSpecifics
1DNS record typesA, AAAA, CNAME, MX, NS, TXT — know what each does
2IdempotencyWhy it matters in payment systems, how to implement (idempotency keys)
3Certificate validationHow SSL/TLS handshake works, role of Certificate Authorities, how your computer validates a CA locally
4Process vs ThreadMemory sharing, when to use which
5Context switchingWhat happens at OS level, overhead
6What happens when you play a song and code on a single-core PCExplain context switching, scheduling
7How HashMap works internallyHash function, buckets, collision resolution, Java 8 red-black tree upgrade
8DeadlocksFour conditions, prevention strategies
9Cache coherenceMESI protocol in multicore systems

⚡ Thread-Safety Deep Dive: Race Conditions You MUST Know

The Two Race Conditions That Come Up Again and Again

Race Condition 1: Two threads locking the same node simultaneously

Thread A: reads isLocked = false <-- both see "unlocked" Thread B: reads isLocked = false <-- both proceed Thread A: sets isLocked = true <-- A thinks it locked Thread B: sets isLocked = true <-- B ALSO thinks it locked!

Why it happens: The check-then-set on the lock flag isn't atomic.
Fix: Use a test-and-set (atomic swap) instead of separate read + write.

Race Condition 2: Two threads locking different but related nodes

Node structure: Root / \ NodeA NodeB Thread A wants to lock NodeA Thread B wants to lock NodeB Both need to update Root's "descendantsLocked" counter
Thread A: reads Root.descendantsLocked = 0 Thread B: reads Root.descendantsLocked = 0 Thread A: sets Root.descendantsLocked = 1 Thread B: sets Root.descendantsLocked = 1 <-- LOST UPDATE! Should be 2

Why it happens: Both threads reading and writing the ancestor's shared counter without synchronization.
Fix: Each ancestor node needs its own atomic increment mechanism.

How to Trace Thread Interleavings (Practice This Format)

Time | Thread A | Thread B | Tree State -----|-----------------------------------|-----------------------------------|------------------ T1 | lock(NodeX, uid=1) | | All unlocked T2 | Check: NodeX.isLocked? -> false | | T3 | | lock(NodeX, uid=2) | T4 | | Check: NodeX.isLocked? -> false | <-- RACE! T5 | Set NodeX.isLocked = true | | NodeX locked by 1 T6 | | Set NodeX.isLocked = true | NodeX locked by 2! T7 | Return true | Return true | <-- BUG: both succeed

Approaches to Fix Without Standard Primitives

Approach 1: Spin Lock via Test-and-Set

// Build your own lock using compiler intrinsic int lock_flag = 0; // 0 = unlocked, 1 = locked void acquire(int *flag) { while (__sync_lock_test_and_set(flag, 1) == 1) { // Spin-wait (busy loop) } } void release(int *flag) { __sync_lock_release(flag); }

Approach 2: Per-Node Integer Flag with Atomic Increment

// Instead of boolean isLocked, use an integer int isLocked = 0; // 0 = unlocked bool tryLock() { // Atomically increment. If result > 1, another thread got there first int prev = __sync_fetch_and_add(&isLocked, 1); if (prev > 0) { // Rollback -- someone else already locked __sync_fetch_and_sub(&isLocked, 1); return false; } return true; }

Approach 3: Peterson's Algorithm (If ALL atomics are banned)

// For two threads sharing a node bool flag[2] = {false, false}; int turn = 0; // Thread i (i = 0 or 1) void lock(int i) { flag[i] = true; turn = 1 - i; while (flag[1-i] && turn == 1 - i) { // busy wait } } void unlock(int i) { flag[i] = false; }

Key Concepts to Explain (Practice Verbally)

  • Contention — what happens when many threads try to lock nearby nodes
  • Fine-grained vs Coarse-grained locking — trade-offs (more locks = more parallelism but more overhead)
  • Lock-free programming — CAS (Compare-And-Swap) operations
  • Why naive mutex kills concurrency — if you lock the entire tree, only one thread can operate at a time
  • Siblings should not block each other — operations on independent subtrees must proceed in parallel
  • Lock ordering — always acquire locks in same order to prevent deadlocks (e.g., always leaf-to-root or root-to-leaf)
  • ABA problem — a thread reads value A, another changes it to B then back to A, first thread thinks nothing changed

📚 CS Fundamentals Topics to Prepare

Operating Systems (Deep Dive)

TopicSub-Topics
Process vs ThreadMemory sharing, IPC mechanisms (pipes, message queues, shared memory, sockets), when to use which
Thread LifecycleNew -> Runnable -> Running -> Blocked/Waiting -> Terminated
CPU SchedulingFCFS, SJF, SRTF, Round Robin, Priority Scheduling — calculate waiting/turnaround time
Context SwitchingWhat happens at OS level, registers saved, overhead, "playing a song while coding on single-core"
SynchronizationCritical section, mutex vs semaphore (binary vs counting), monitor, condition variables
DeadlocksFour conditions (Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait), Prevention, Avoidance (Banker's), Detection
Memory ManagementPaging, Segmentation, Virtual Memory, Page Replacement (FIFO, LRU, Optimal), Thrashing
Multicore ProcessorsTrue parallelism vs concurrency, cache coherence (MESI protocol), Amdahl's Law
Process StructureCode/Text segment, Data segment, Heap, Stack, PCB
Compiler vs InterpreterJIT compilation, optimization question: function called 1000 times with same behavior

Computer Networks

TopicSub-Topics
DNSResolution process (recursive vs iterative), Record types: A, AAAA, CNAME, MX, NS, TXT — know what each does
TCP vs UDP3-way handshake, 4-way termination, flow control (sliding window), congestion control
HTTP/HTTPSMethods (GET/POST/PUT/DELETE), Status codes (200/301/400/401/403/404/500), HTTP/1.1 vs HTTP/2 vs HTTP/3
SSL/TLSHandshake process, Certificate Authorities (CA), how computer validates CA locally, symmetric vs asymmetric encryption
IP AddressingIPv4 classes, subnetting, CIDR, IPv6, NAT, Private vs Public IP
IdempotencyWhy critical in payments, implementation with idempotency keys
Session ManagementHow server differentiates two tabs on same laptop, two laptops on same network, two laptops on different networks

Database Fundamentals

TopicSub-Topics
ACID PropertiesAtomicity, Consistency, Isolation, Durability
IndexingB-Tree, Hash index, Composite index, when indexing hurts
Transaction Isolation LevelsRead Uncommitted, Read Committed, Repeatable Read, Serializable
Normalization1NF, 2NF, 3NF, BCNF, when to denormalize
SQL vs NoSQLWhen to use which, trade-offs

Encryption & Security

TopicSub-Topics
Symmetric EncryptionAES — same key for encrypt/decrypt
Asymmetric EncryptionRSA — public/private key pair
HashingSHA-256, bcrypt for passwords (one-way)
Digital SignaturesSign with private key, verify with public key
JWTStructure (Header.Payload.Signature), HMAC vs RSA signing, Access vs Refresh tokens

🔧 Other Things to Prepare

Resume & Project Defense (30+ min of cross-questioning is common!)

For EVERY project on your resume, prepare:

  • Problem Statement — What problem does it solve?
  • Architecture — High-level diagram, components, how they interact
  • Tech Stack — Why you chose each technology, what alternatives you considered
  • Your Contribution — What specifically YOU built
  • Challenges — Hardest technical challenge and how you solved it
  • Scale — How many users/requests/data?
  • Trade-offs — What design trade-offs and why?
  • What Would You Change — If you rebuilt it, what differently?
  • Measurable Impact — Reduced latency by X%, throughput by Y%

Cross-questioning patterns to expect:

  • "Why did you use X instead of Y?"
  • "What happens if this component fails?"
  • "How would you scale this to 10x users?"
  • "What's the time complexity of your critical path?"
  • "How would you make this thread-safe?"

Behavioral / HR Questions

  • Why Juspay? (Research: payment infrastructure, 300M+ transactions/day, works with Amazon/Flipkart/Google)
  • Describe a production bug you resolved
  • A time you disagreed with a technical decision
  • Your debugging approach under time pressure
  • Long-term career goals
  • Why payment infrastructure aligns with your career

Communication Strategy During Interview

  • Think out loud — let the interviewer see your thought process
  • Start with brute force, then optimize — show progression
  • Clarify constraints before coding (input size, edge cases, performance expectations)
  • Dry run your solution step by step
  • Explicitly state time and space complexity after every solution
  • Don't accept "this is thread-safe" at face value — always verify

Mental Endurance

  • Some rounds last 8-12 hours — build stamina
  • Practice solving problems for long stretches
  • Stay calm when stuck — ask for hints politely
  • Don't panic if you get unexpected questions

✅ Master Checklist — Everything You Need to Do

🔴 Priority 1: Tree of Space (Do This FIRST)

  • Re-implement Tree of Space from scratch, cold, in whatever language you'll use — including Upgrade, which people forget to re-practice
  • Be able to build the M-ary tree from array input using level-order (BFS with queue)
  • Derive complexity verbally — Lock: O(log_m N), Unlock: O(log_m N), Upgrade: O(k*log_m N)
  • Explain WHY each complexity is what it is (height of M-ary tree, ancestor walk, descendant iteration)
  • Write out, in words, exactly where the race conditions are in your own lock() and why — before anyone asks
  • Practice explaining a race condition via a manual thread-interleaving trace on paper — this is asked constantly
  • Implement thread-safe version without mutex/semaphore — using test-and-set or CAS
  • Practice the "push back" scenario — if someone tells you a solution is thread-safe, find the bug
  • Handle edge cases: locking a node with locked descendants, upgrade when some descendants locked by different uids, interleaved lock/unlock/upgrade, empty tree, single node tree

🔴 Priority 2: DSA Problems

  • Solve Open the Lock (LeetCode 752) — explain brute force -> BFS -> complexity
  • Solve Basic Calculator (LeetCode 224)
  • Solve Highest Score with Tie-Break — HashMap + replay
  • Solve Job Scheduling / Minimize Max Load — Greedy + Min-Heap
  • Solve Maximum Weight Node (Juspay OA classic)
  • Solve Nearest Meeting Cell (Juspay OA classic)
  • Solve Largest Sum Cycle (Juspay OA classic)
  • Solve Word Ladder (LeetCode 127)
  • Solve LRU Cache (LeetCode 146)
  • Practice prefix sum / range query problems
  • Practice hashing + backtracking combination problems

🔴 Priority 3: Thread-Safety & Concurrency Concepts

  • Understand and explain race conditions with examples
  • Know how to build a mutex from scratch using __sync_lock_test_and_set
  • Know Peterson's Algorithm (if ALL hardware atomics are banned)
  • Understand CAS (Compare-And-Swap) — how it works, ABA problem
  • Practice tracing thread interleavings on paper for at least 3 scenarios
  • Explain fine-grained vs coarse-grained locking with trade-offs
  • Explain lock ordering to prevent deadlocks
  • Know volatile keyword — why reads/writes must go to main memory
  • Know memory ordering — why instruction reordering matters

🟡 Priority 4: CS Fundamentals

  • OS: Process vs Thread, Context Switching, Deadlocks (4 conditions + prevention), Scheduling algorithms, Virtual Memory, Paging
  • CN: DNS resolution + record types, TCP 3-way handshake, HTTP status codes, SSL/TLS handshake, Certificate validation
  • Idempotency: What it is, why critical in payments, how to implement
  • How HashMap works internally (hash function, buckets, collisions, Java 8 red-black tree)

🟡 Priority 5: OOP & Design

  • SOLID principles — explain each with a real example
  • Adapter pattern — converting one class interface to another (actually asked!)
  • Strategy pattern, Observer pattern, Singleton (thread-safe)
  • Practice: "How would you model payment methods using OOP?"

🟢 Priority 6: Puzzles

  • Solve: Odd weight egg / balance scale (divide into thirds)
  • Solve: Two people meet within an hour, each waits 10 min (geometric probability)
  • Solve: Burning rope problem (45 minutes)
  • Solve: Egg drop problem
  • Review: 25 horses puzzle, Monty Hall, Birthday paradox

🟢 Priority 7: Resume

  • Skim your resume for anything you'd struggle to defend for 20+ minutes straight
  • For each project: prepare problem/architecture/tech-stack/contribution/challenges/scale/trade-offs answers
  • Practice answering "Why Juspay?" — payment infrastructure, scale, tech challenges

📅 2-Day Prep Priority Schedule

Day 1 — Foundation Day

Time BlockWhat to Do
Morning (3 hrs)Re-implement Tree of Space from scratch (cold). Include Lock, Unlock, UpgradeLock. Derive all complexities verbally.
Midday (2 hrs)Write out race conditions in your lock(). Practice 3 thread-interleaving traces on paper. Implement thread-safe version.
Afternoon (3 hrs)Solve: Open the Lock (752), Basic Calculator (224), Highest Score problem, Job Scheduling/Min-Max Load.
Evening (2 hrs)Review: Maximum Weight Node, Nearest Meeting Cell, Largest Sum Cycle. Solve if not done.
Night (1 hr)Review OS: Process vs Thread, Deadlocks, Context Switching. Review CN: DNS record types, SSL/TLS.

Day 2 — Polish Day

Time BlockWhat to Do
Morning (2 hrs)Re-derive all Part A complexities without looking at code. Practice explaining race conditions out loud. Do the "push back" exercise.
Afternoon (2 hrs)Solve 2-3 more LeetCode problems (Word Ladder, LRU Cache, prefix sum). Review OOP: SOLID, Adapter/Strategy patterns.
Evening (2 hrs)Resume defense prep — for each project, practice answering cross-questions for 5 min each. Review puzzles (balance scale, meeting probability, burning rope).
Night (1 hr)Final review: Idempotency, HashMap internals, CAS/test-and-set, Peterson's algorithm. Light skim of all notes.

🧠 Quick-Reference: Things to Say Out Loud During Interview

When Explaining Tree of Space Complexity

"The height of an M-ary tree with N nodes is log base M of N. Lock and Unlock walk from the node to the root, which is O(height) = O(log_m N). Upgrade additionally iterates over k locked descendants, each of which requires its own ancestor walk, giving O(k * log_m N)."

When Naming Race Conditions

"There are two key race conditions. First, the check-then-set on isLocked isn't atomic — two threads can both read false and both set true. Second, when two threads lock different nodes sharing a common ancestor, both try to update the ancestor's descendantsLocked counter simultaneously, causing a lost update."

When Asked "Is This Thread-Safe?"

"Let me trace through a specific interleaving to verify. Suppose Thread A is at step X and a context switch happens..."

When Asked About Approach Without Mutex

"I would use a test-and-set spin lock at the per-node level. Each node has an integer flag. A thread atomically swaps it to 1 — if the previous value was 0, it acquired the lock. If 1, another thread holds it, and we spin. This gives mutual exclusion without library primitives."


[!TIP] The #1 thing that separates selected candidates from rejected ones in Part B: Being able to name the race conditions yourself before the interviewer points them out, and being able to trace thread interleavings on demand.


Last updated: August 29, 2026
Sources: Real interview experiences from GeeksforGeeks, LeetCode Discuss, Glassdoor, Medium, Unstop — 2022 through 2026 batches