juspay_preparation_guide.md

🎯 Juspay Placement β€” Complete Preparation Guide

Extracted from all real interview experiences β€” covers every round, every topic, every sub-topic you need to master.


πŸ“‹ Understanding the Interview Pipeline

Juspay's hiring process typically has 6–7 rounds (order may vary slightly). Some batches have two elimination rounds.

RoundNameDurationFormat
1Online Coding Assessment (DSA)90–120 min3 coding problems (Graphs, Trees)
2Aptitude / MCQ Round25–60 min16–30 MCQs (CS, Physics, Math)
3Hackathon Part A180 min"Tree of Space" problem
4Elimination Round 160–120 min1–2 DSA problems + Puzzles + Resume
5Elimination Round 2 (sometimes)60–120 minCP-style graph/algorithm problem (~1500 CF rating)
6Hackathon Part B8–12 hoursOptimize Part A + Multi-threading
7System + Cultural Interview (often Onsite)50 min – 8 hoursOS, CN, System Design, LLD, Puzzles, Projects, Debugging existing code

[!IMPORTANT] Every round is eliminatory. The hackathon (Parts A & B) is the core differentiator β€” most candidates are eliminated here.

Typical Selection Funnel (Real Numbers)

StageCandidates Remaining
Applied~350–600
After OA~80–180
After MCQ~50–162
After Hackathon A~15–88
After Elimination 1~12–30
After Elimination 2 (if exists)~8–15
After Hackathon B~3–9
Final offers1–6

[!NOTE] Rounds 1 and 2 sometimes swap order. Some colleges see the MCQ round first, others see the OA first. Prepare for both to come in any order.


1️⃣ APTITUDE & MCQ ROUND

This round tests breadth of fundamentals across CS and basic sciences. You need quick recall and accuracy.


1.1 Operating Systems (MCQ-Level)

  • Process Management

    • What is a process vs a thread
    • Process states: New β†’ Ready β†’ Running β†’ Waiting β†’ Terminated
    • Process Control Block (PCB) β€” what it stores (PID, program counter, registers, memory limits, open files)
    • Context switching β€” what happens when the OS switches from one process to another
    • Fork system call β€” what it does, return values for parent and child
    • Zombie process vs Orphan process
  • CPU Scheduling Algorithms

    • First Come First Served (FCFS) β€” calculate average waiting time, turnaround time
    • Shortest Job First (SJF) β€” preemptive (SRTF) vs non-preemptive
    • Round Robin β€” how time quantum affects performance, calculate waiting time
    • Priority Scheduling β€” starvation problem and aging solution
    • Multilevel Queue Scheduling
    • Convoy effect in FCFS
  • Memory Management

    • Paging β€” page table, page number, offset calculation
    • Segmentation β€” difference from paging
    • Virtual Memory β€” page fault, demand paging
    • Page Replacement Algorithms β€” FIFO, LRU, Optimal (Belady's algorithm)
    • Belady's Anomaly β€” why more frames can cause more page faults in FIFO
    • Thrashing β€” what causes it, working set model
    • Internal fragmentation vs External fragmentation
  • Deadlocks

    • Four necessary conditions: Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait
    • Deadlock Prevention β€” how to break each condition
    • Deadlock Avoidance β€” Banker's Algorithm (safe state, safe sequence)
    • Deadlock Detection β€” Resource Allocation Graph, wait-for graph
    • Deadlock Recovery strategies
  • Synchronization

    • Critical Section problem β€” mutual exclusion, progress, bounded waiting
    • Mutex vs Semaphore β€” binary semaphore vs counting semaphore
    • Producer-Consumer problem
    • Readers-Writers problem
    • Dining Philosophers problem
    • Peterson's Solution
    • Test-and-Set, Compare-and-Swap (hardware solutions)
  • File Systems

    • File allocation methods: contiguous, linked, indexed
    • Directory structures: single-level, two-level, tree-structured
    • Disk scheduling algorithms: FCFS, SSTF, SCAN, C-SCAN, LOOK

1.2 Computer Networks (MCQ-Level)

  • OSI Model β€” All 7 Layers

    • Physical Layer β€” what it handles (bits, cables, signals)
    • Data Link Layer β€” framing, MAC address, error detection (CRC, checksum, parity)
    • Network Layer β€” IP addressing, routing
    • Transport Layer β€” TCP vs UDP, port numbers
    • Session Layer β€” session management
    • Presentation Layer β€” encryption, compression
    • Application Layer β€” HTTP, FTP, DNS, SMTP
  • TCP/IP Model β€” 4 Layers

    • How it maps to OSI
    • What protocols belong to each layer
  • IP Addressing

    • IPv4 β€” classes (A, B, C, D, E), subnet mask, CIDR notation
    • Subnetting β€” how to calculate number of subnets, hosts per subnet
    • Private vs Public IP addresses
    • IPv6 β€” why it was needed, format, differences from IPv4
    • NAT (Network Address Translation) β€” how it works, types (Static, Dynamic, PAT)
  • TCP vs UDP

    • Connection-oriented vs connectionless
    • Reliable vs unreliable delivery
    • TCP 3-way handshake: SYN β†’ SYN-ACK β†’ ACK
    • TCP 4-way termination: FIN β†’ ACK β†’ FIN β†’ ACK
    • Flow control β€” sliding window protocol
    • Congestion control β€” slow start, congestion avoidance, fast retransmit, fast recovery
    • When to use TCP vs UDP (examples: HTTP uses TCP, DNS uses UDP for queries)
  • HTTP / HTTPS

    • HTTP methods: GET, POST, PUT, DELETE, PATCH
    • Status codes: 200, 301, 400, 401, 403, 404, 500, 502, 503
    • HTTP/1.1 vs HTTP/2 vs HTTP/3
    • HTTPS β€” how TLS/SSL works, certificate exchange, symmetric vs asymmetric encryption
    • Cookies vs Sessions vs Tokens
  • DNS

    • How DNS resolution works step by step (recursive vs iterative query)
    • DNS record types: A, AAAA, CNAME, MX, NS, TXT
    • DNS caching β€” TTL
  • Routing

    • Distance Vector Routing β€” Bellman-Ford algorithm, count-to-infinity problem
    • Link State Routing β€” Dijkstra's algorithm
    • BGP, OSPF β€” what they are at a high level
  • How YouTube/Google Drive Work (Actually Asked!)

    • How the server differentiates between two tabs on the same laptop (session ID, cookies, different socket connections)
    • How the server differentiates between two laptops on the same network (different source ports via NAT, different cookies/sessions)
    • How the server differentiates between two laptops on different networks (different public IP addresses)
    • How files are uploaded to Google Drive and shared between systems (chunked upload, cloud storage, share via URL with access tokens)

1.3 Mathematics (MCQ-Level)

  • Discrete Mathematics

    • Permutations and Combinations β€” nCr, nPr formulas, problems involving selecting/arranging
    • Probability β€” basic probability, conditional probability, Bayes' theorem
    • Set Theory β€” union, intersection, difference, De Morgan's laws, inclusion-exclusion principle
    • Relations β€” reflexive, symmetric, transitive, equivalence relations
    • Functions β€” injective (one-to-one), surjective (onto), bijective
    • Propositional Logic β€” AND, OR, NOT, implication, biconditional, truth tables
    • Predicate Logic β€” universal and existential quantifiers
  • Linear Algebra

    • Matrix operations β€” addition, multiplication, transpose
    • Determinant of a matrix β€” 2Γ—2 and 3Γ—3
    • Inverse of a matrix β€” when it exists (non-singular)
    • Eigenvalues and Eigenvectors β€” basic definition, how to compute for 2Γ—2
    • Rank of a matrix
  • Calculus (Basic)

    • Limits β€” basic limit evaluation, L'HΓ΄pital's rule
    • Differentiation β€” power rule, chain rule, product rule
    • Integration β€” basic integrals, integration by parts
    • Maxima and Minima
  • Number Theory

    • GCD, LCM β€” Euclidean algorithm
    • Modular arithmetic β€” properties, modular inverse
    • Prime numbers β€” Sieve of Eratosthenes

1.4 Physics (MCQ-Level β€” Class 12 Level)

[!NOTE] Multiple candidates confirmed physics questions appear. They are mostly formula-based, Class 12 level.

  • Mechanics

    • Newton's Laws of Motion β€” force, acceleration, action-reaction
    • Work, Energy, Power β€” kinetic energy, potential energy, work-energy theorem
    • Rotational Motion β€” moment of inertia, torque, angular momentum
  • Electrostatics & Current Electricity

    • Coulomb's Law β€” force between charges
    • Electric field and potential β€” point charge, dipole
    • Capacitance β€” parallel plate capacitor, series and parallel combinations
    • Ohm's Law β€” V = IR
    • Kirchhoff's Laws β€” KCL (junction rule), KVL (loop rule)
    • Wheatstone Bridge
    • RC circuits β€” time constant
  • Magnetism & Electromagnetic Induction

    • Biot-Savart Law
    • Ampere's Law
    • Faraday's Law of Electromagnetic Induction
    • Lenz's Law
    • Self-inductance, mutual inductance
    • Transformers β€” step-up, step-down
  • Optics

    • Reflection β€” plane mirrors, spherical mirrors (concave, convex)
    • Refraction β€” Snell's law, total internal reflection, critical angle
    • Lenses β€” thin lens formula, magnification
    • Interference β€” Young's double slit experiment
    • Diffraction β€” single slit
  • Modern Physics

    • Photoelectric effect β€” Einstein's equation, threshold frequency, work function
    • de Broglie wavelength
    • Bohr's model of hydrogen atom β€” energy levels, spectral series
    • Radioactivity β€” alpha, beta, gamma decay, half-life

2️⃣ DATA STRUCTURES & ALGORITHMS (DSA)

This is the most heavily tested area across all rounds (OA, Elimination, Hackathon).


2.1 Arrays & Strings

  • Array Fundamentals

    • Traversal, insertion, deletion
    • Two-pointer technique β€” when to use, classic problems (container with most water, trapping rain water)
    • Kadane's Algorithm β€” maximum subarray sum
    • Prefix Sum β€” range sum queries, subarray sum equals K
    • Suffix arrays β€” when useful
    • Dutch National Flag problem (sort 0s, 1s, 2s)
    • Merge overlapping intervals β€” sort by start, merge
    • Minimum swaps to sort an array
  • Sliding Window

    • Fixed-size sliding window β€” maximum sum subarray of size K
    • Variable-size sliding window β€” longest substring without repeating characters
    • Longest subarray with at most K distinct elements
    • Minimum window substring
    • When to expand vs shrink the window
  • Hashing

    • How HashMap works internally β€” hash function, buckets, collision resolution
    • HashMap before Java 8 (linked list chaining) vs after Java 8 (red-black tree for buckets with >8 entries)
    • O(1) average lookup β€” why and when it degrades
    • Two Sum problem using HashMap
    • Frequency counting β€” first non-repeating character, anagram detection
    • Group Anagrams
    • Subarray with given sum (prefix sum + HashMap)
  • String Algorithms

    • String matching β€” brute force O(n*m), KMP algorithm O(n+m)
    • Rabin-Karp algorithm β€” rolling hash
    • Palindrome detection β€” two pointers, Manacher's algorithm
    • Longest Palindromic Substring
    • String reversal, rotation, permutation

2.2 Linked Lists

  • Singly Linked List β€” insertion, deletion, traversal, reversal
  • Doubly Linked List β€” insertion, deletion, reversal
  • Floyd's Cycle Detection β€” slow and fast pointer, finding cycle start
  • Merge two sorted linked lists
  • Reverse in groups of K
  • LRU Cache implementation β€” HashMap + Doubly Linked List for O(1) get and put

2.3 Stacks & Queues

  • Stack operations β€” push, pop, peek, isEmpty
  • Queue operations β€” enqueue, dequeue, front, isEmpty
  • Implementing stack using queues and vice versa
  • Monotonic Stack β€” next greater element, stock span problem
  • Min Stack β€” O(1) min retrieval
  • Valid parentheses, balanced brackets
  • Infix to Postfix conversion, evaluation of postfix expression
  • Circular Queue
  • Deque (Double-ended Queue)
  • Priority Queue (Min-Heap, Max-Heap) β€” heapify, insert, extract operations

2.4 Trees (CRITICAL β€” Juspay's Favorite)

[!CAUTION] Trees appear in almost EVERY round β€” OA, Hackathon, Elimination, System Interview. Master this thoroughly.

  • Binary Tree Fundamentals

    • Tree terminology: root, leaf, internal node, height, depth, level, degree
    • Tree traversals:
      • Inorder (Left, Root, Right)
      • Preorder (Root, Left, Right)
      • Postorder (Left, Right, Root)
      • Level Order (BFS using queue)
    • Recursive vs Iterative traversals
    • Height of a binary tree β€” recursive calculation
    • Proving h = log(N) for balanced binary tree logically without formulas (actually asked: at each level the number of nodes doubles, so the number of levels needed to accommodate N nodes is logβ‚‚(N))
    • Diameter of a binary tree
    • Check if two trees are identical
    • Mirror / Invert a binary tree
    • Lowest Common Ancestor (LCA) β€” recursive approach
    • Maximum path sum in a binary tree
  • Binary Search Tree (BST)

    • BST property: left < root < right
    • Search, Insert, Delete operations
    • Inorder traversal gives sorted order
    • Validate if a tree is BST
    • Kth smallest element in BST
    • Floor and Ceiling in BST
  • M-ary Trees (CRITICAL for Hackathon)

    • What is an M-ary tree β€” each node has at most M children
    • Building an M-ary tree from array input using level-order (BFS with queue)
    • Number of leaf nodes in a complete M-ary tree of height h: m^h
    • Total nodes in a complete M-ary tree: (m^(h+1) - 1) / (m - 1)
    • Parent-child relationship in array representation
    • Traversal of M-ary trees
  • Tree of Space Problem (Hackathon β€” THE Problem)

    • Lock(node, uid): Lock a node if:
      • The node is not already locked
      • No ancestor is locked
      • No descendant is locked
    • Unlock(node, uid): Unlock a node if:
      • It is currently locked
      • It was locked by the same uid
    • UpgradeLock(node, uid): Upgrade lock from descendants to ancestor if:
      • All locked descendants were locked by the same uid
      • No ancestor is locked
      • At least one descendant is locked
    • Data structure design:
      • Node struct: name, parent pointer, isLocked flag, lockedBy uid, set of locked descendants
      • HashMap from node name β†’ Node pointer for O(1) lookup
    • Complexity analysis:
      • Lock: O(height) for ancestor check + O(height) for propagating locked descendant info
      • Unlock: O(height) for removing from ancestors' locked descendant sets
      • Upgrade: O(height + number of locked descendants)
    • Edge cases:
      • Locking a node that already has locked descendants
      • Upgrade when some descendants are locked by different uids
      • Interleaved lock/unlock/upgrade operations
      • Empty tree, single node tree
  • Trie (Prefix Tree)

    • Trie node structure β€” array/map of children, isEndOfWord flag
    • Insert, Search, StartsWith operations
    • Autocomplete feature
    • Word search in a board (DFS + Trie)
  • Segment Tree & Fenwick Tree (Binary Indexed Tree)

    • Segment Tree β€” build, range query, point update, lazy propagation
    • Fenwick Tree β€” point update, prefix sum query
    • When to use which β€” Fenwick for prefix sums, Segment Tree for more complex range operations
    • Problems: range sum query, range minimum query

2.5 Graphs (CRITICAL)

  • Graph Representations

    • Adjacency Matrix β€” when to use (dense graphs), space O(VΒ²)
    • Adjacency List β€” when to use (sparse graphs), space O(V+E)
    • Edge List
  • Graph Traversals

    • BFS (Breadth-First Search) β€” level-order traversal, uses queue
      • Finding shortest path in unweighted graph
      • Connected components
      • Bipartite check
    • DFS (Depth-First Search) β€” uses stack/recursion
      • Cycle detection in directed graph (using visited + recursion stack)
      • Cycle detection in undirected graph (using parent tracking)
      • Topological Sort β€” Kahn's algorithm (BFS) and DFS-based
      • Strongly Connected Components β€” Kosaraju's / Tarjan's algorithm
  • Shortest Path Algorithms

    • Dijkstra's Algorithm β€” single source, non-negative weights, O((V+E) log V) with priority queue
    • Bellman-Ford Algorithm β€” handles negative weights, detects negative cycles
    • Floyd-Warshall β€” all-pairs shortest path, O(VΒ³)
    • 0-1 BFS β€” for graphs with edge weights 0 or 1 (using deque)
  • Minimum Spanning Tree

    • Kruskal's Algorithm β€” sort edges, union-find
    • Prim's Algorithm β€” greedy, priority queue
  • Union-Find (Disjoint Set Union)

    • Find with path compression
    • Union by rank/size
    • Detect cycle in undirected graph
    • Connected components
  • Specific Graph Problems (Asked in Juspay)

    • Reachability between two nodes β€” BFS/DFS
    • Shortest path between two nodes β€” BFS (unweighted) or Dijkstra (weighted)
    • Minimum vertex cut β€” minimum set of people to remove to disconnect two nodes (max-flow min-cut concept)
    • Level order traversal of a forest
    • Depth with maximum nodes in a forest
    • Word Ladder using BFS β€” shortest transformation sequence
    • Open the Lock problem β€” BFS on state space (4-digit lock, each digit 0-9, avoid deadends)

2.6 Dynamic Programming

  • Core Concepts

    • Overlapping subproblems β€” same subproblems solved multiple times
    • Optimal substructure β€” optimal solution contains optimal solutions of subproblems
    • Memoization (top-down) vs Tabulation (bottom-up)
    • Space optimization β€” using 1D array instead of 2D when only previous row is needed
  • Classic DP Problems

    • Fibonacci sequence β€” basic DP example
    • 0/1 Knapsack β€” include or exclude each item
    • Unbounded Knapsack β€” items can be reused
    • Longest Common Subsequence (LCS)
    • Longest Increasing Subsequence (LIS) β€” O(nΒ²) DP, O(n log n) with binary search
    • Edit Distance (Levenshtein Distance)
    • Coin Change β€” minimum coins to make amount
    • Matrix Chain Multiplication
    • Subset Sum
    • Palindrome Partitioning
    • DP on Trees β€” house robber on tree
    • DP on Graphs β€” shortest path with constraints
  • DP with State Management on Graphs (Asked in OA)

    • Combining graph traversal with DP state tracking
    • Understanding optimal substructure in graph context

2.7 Recursion & Backtracking

  • Recursion Fundamentals

    • Base case and recursive case
    • Recursion tree visualization
    • Stack overflow risks β€” tail recursion optimization
    • Converting recursion to iteration
  • Backtracking Problems

    • N-Queens problem
    • Sudoku Solver
    • Permutations and Combinations generation
    • Subset generation β€” power set
    • Word Search on a grid
    • Rat in a Maze
    • Graph coloring
    • Pruning strategies β€” how to cut branches early

2.8 Binary Search

  • Core Binary Search

    • Standard binary search on sorted array
    • Finding first/last occurrence
    • Search in rotated sorted array
    • Square root using binary search
    • Peak element
  • Binary Search on Answer

    • Minimum capacity to ship packages within D days
    • Aggressive cows / Magnetic balls β€” maximize minimum distance
    • Koko eating bananas β€” minimize speed
    • Allocate minimum number of pages
    • Kth smallest element in a sorted matrix

2.9 Greedy Algorithms

  • Activity Selection problem
  • Fractional Knapsack
  • Huffman Coding
  • Job Sequencing with deadlines
  • Minimum platforms required
  • Interval scheduling β€” merge intervals, non-overlapping intervals

3️⃣ OBJECT-ORIENTED PROGRAMMING (OOP)

[!NOTE] OOP is tested in Hackathon Part A (designing the tree structure), LLD round, and system interview.


3.1 Four Pillars of OOP

  • Encapsulation

    • Bundling data and methods into a class
    • Access modifiers: private, protected, public
    • Getters and setters β€” why not just make fields public
    • Information hiding β€” exposing only what's necessary
  • Abstraction

    • Abstract classes vs Interfaces β€” when to use which
    • Abstract methods β€” declared but not implemented
    • Real-world analogy: car steering wheel hides engine complexity
    • Achieving abstraction in Java/C++
  • Inheritance

    • Single, Multilevel, Hierarchical, Multiple (via interfaces in Java)
    • Method overriding β€” runtime polymorphism
    • super keyword β€” calling parent constructor/method
    • Diamond problem β€” how Java resolves it with interfaces
    • IS-A relationship
    • When to prefer composition over inheritance
  • Polymorphism

    • Compile-time (static) β€” method overloading, operator overloading
    • Runtime (dynamic) β€” method overriding, virtual functions (C++), vtable
    • Upcasting and downcasting
    • instanceof operator

3.2 Other OOP Concepts

  • Constructors & Destructors

    • Default, parameterized, copy constructor
    • Constructor chaining
    • Destructor β€” when it's called, preventing memory leaks
  • Static Members

    • Static variables β€” shared across all instances
    • Static methods β€” called without object
    • Static blocks in Java
  • Final / Const

    • Final class β€” cannot be inherited
    • Final method β€” cannot be overridden
    • Final variable β€” constant after initialization
  • this and super keywords

  • Object class in Java

    • toString(), equals(), hashCode(), clone(), finalize()
    • Contract between equals() and hashCode()

4️⃣ LOW-LEVEL DESIGN (LLD) β€” Machine Coding

[!WARNING] One candidate was surprised with an LLD round when they expected System Design. Be prepared for LLD even if HR says otherwise.


4.1 SOLID Principles

  • S β€” Single Responsibility Principle: Each class should have only one reason to change
  • O β€” Open/Closed Principle: Open for extension, closed for modification
  • L β€” Liskov Substitution Principle: Subtypes must be substitutable for base types
  • I β€” Interface Segregation Principle: Many specific interfaces better than one general-purpose
  • D β€” Dependency Inversion Principle: Depend on abstractions, not concrete implementations

4.2 Design Patterns (Most Important Ones)

  • Creational Patterns

    • Singleton β€” one instance globally, thread-safe singleton (double-checked locking, enum approach)
    • Factory Method β€” create objects without specifying exact class
    • Abstract Factory β€” factory of factories
    • Builder β€” step-by-step object construction
  • Structural Patterns

    • Adapter β€” convert interface of a class to another
    • Decorator β€” add functionality dynamically
    • Facade β€” simplified interface to complex subsystem
  • Behavioral Patterns

    • Strategy β€” swap algorithms at runtime
    • Observer β€” publish-subscribe notification
    • Command β€” encapsulate request as object
    • State β€” object behavior changes based on internal state

4.3 LLD Problems to Practice (Actually Asked)

  • Parking Lot System (ACTUALLY ASKED β€” detailed version)

    • Multi-storey building (5 floors)
    • Each floor has sections A, B, C, D
    • Each section has 10 car slots
    • Each car slot can alternatively park 4 motorcycles
    • Fare: β‚Ή20 per hour
    • APIs to implement:
      • park(vehicle) β€” suggest best available spot
      • unpark(vehicle) β€” free up the spot
      • calculateFare(vehicle) β€” based on hours parked
    • Design the most efficient way to assign spots so maximum cars can be parked
    • Handle interleaved park/unpark operations
    • Edge cases: all slots full, motorcycle in car slot, unpark followed by park
  • LRU Cache

    • HashMap + Doubly Linked List
    • O(1) get and put
    • Eviction policy when cache is full
  • URL Shortener

    • Base62 encoding
    • Unique key generation (counter-based, hash-based)
    • Database schema for mapping
  • Rate Limiter

    • Token Bucket algorithm
    • Leaky Bucket algorithm
    • Sliding Window Log
    • Sliding Window Counter
  • Payment Gateway (Simplified)

    • Transaction states: INITIATED β†’ PROCESSING β†’ SUCCESS/FAILED
    • Idempotency keys β€” prevent duplicate charges
    • Retry mechanism with exponential backoff
    • Refund handling
  • In-Memory Key-Value Store

    • GET, SET, DELETE operations
    • Optional TTL (expiry)
    • Thread-safe access

5️⃣ MULTITHREADING & CONCURRENCY (Hackathon Part B)

[!CAUTION] This is tested extensively in Hackathon Part B. You need to make the Tree of Space solution thread-safe from scratch, no libraries, no atomic variables allowed.


5.1 Thread Fundamentals

  • What is a thread vs a process
  • Thread lifecycle: New β†’ Runnable β†’ Running β†’ Blocked/Waiting β†’ Terminated
  • Creating threads β€” extending Thread class (Java), implementing Runnable, using std::thread (C++)
  • Thread scheduling β€” how OS decides which thread runs
  • Thread priorities
  • Daemon threads vs User threads

5.2 Synchronization Mechanisms

  • Mutex (Mutual Exclusion)

    • What it is β€” only one thread can hold the lock at a time
    • Lock and unlock operations
    • Why mutex kills concurrency β€” if you lock the entire tree, only one thread can operate at a time
    • Granular locking β€” lock individual nodes or paths instead of entire data structure
  • Semaphore

    • Binary Semaphore β€” similar to mutex
    • Counting Semaphore β€” allows N threads to access resource simultaneously
    • wait() and signal() operations
    • Difference from mutex: semaphore can be signaled by any thread, mutex only by owner
  • Atomic Operations (Explicitly Asked in Hackathon B)

    • What "atomic" means β€” an operation that completes entirely or not at all, indivisible
    • Compare-And-Swap (CAS) β€” atomically compare current value and swap if it matches expected
    • Test-And-Set β€” atomically set a flag and return old value
    • Fetch-And-Add β€” atomically increment a counter
    • Memory ordering β€” why instruction reordering matters in multi-threaded code
    • Volatile keyword β€” ensures reads/writes go to main memory, not cached
    • Why atomic operations are NOT allowed in some Juspay rounds β€” forces you to implement locking from scratch
  • Shared vs Exclusive Locking (Explicitly Discussed)

    • Shared (Read) Lock β€” multiple threads can hold it simultaneously for reading
    • Exclusive (Write) Lock β€” only one thread can hold it, blocks all others (readers AND writers)
    • Read-Write Lock pattern β€” allow concurrent reads, exclusive writes
    • Upgrade lock β€” converting a shared lock to exclusive lock (directly relevant to Tree of Space Upgrade operation)
    • Downgrade lock β€” converting exclusive to shared
    • When to use shared vs exclusive β€” read-heavy workloads benefit from shared locks
    • Starvation risk β€” writers may starve if readers keep arriving (writer-preference vs reader-preference policies)
  • Monitor

    • Synchronized blocks in Java
    • Condition variables β€” wait(), notify(), notifyAll()
  • Read-Write Locks

    • Multiple readers can read simultaneously
    • Writer needs exclusive access
    • Prevents reader starvation, writer starvation

5.3 Concurrency Problems & Solutions

  • Race Conditions

    • What they are β€” two threads accessing shared data simultaneously, result depends on timing
    • Example: two threads incrementing a counter β€” lost updates
    • Prevention: mutual exclusion, atomic operations
  • Deadlocks

    • Four conditions: Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait
    • Prevention strategies β€” break one condition
    • Lock ordering β€” always acquire locks in same order
    • Timeout-based locking
  • Livelocks

    • Threads keep changing state in response to each other but make no progress
    • Example: two people in a hallway keep moving to the same side
  • Starvation

    • A thread never gets to execute because others keep getting priority
    • Prevention: fair scheduling, aging
  • Priority Inversion

    • Low-priority thread holds lock needed by high-priority thread
    • Solution: priority inheritance protocol

5.4 Thread-Safe Tree of Space (Hackathon Part B Specifics)

  • Why naive locking fails:

    • Locking entire tree with one mutex kills all concurrency
    • Must allow operations on different parts of tree simultaneously
  • Per-Node Locking Strategy:

    • Each node gets its own lock
    • When locking a node: acquire locks along the path from node to root
    • Lock ordering: always lock from leaf to root (or root to leaf β€” be consistent)
    • Release locks as soon as the check passes
  • Test-and-Set Approach (Actually Used by Selected Candidates):

    • Use an integer flag (isLocked) instead of boolean
    • Increment atomically: isLocked++
    • If isLocked > 1, another thread is already locking β€” rollback and return false
    • This avoids full mutex overhead while providing thread safety
  • Logical Approach (What Interviewers Prefer):

    • If one thread is processing a node, other nodes should know the result without waiting
    • Siblings should not block each other
    • Use a sibLock counter to track if sibling subtrees are being modified
  • Key Concepts to Explain:

    • Contention β€” what happens when many threads try to lock nearby nodes
    • Fine-grained vs coarse-grained locking β€” trade-offs
    • Lock-free programming β€” CAS (Compare-And-Swap) operations
    • How to implement locking from scratch (without std::mutex or synchronized)

6️⃣ OPERATING SYSTEMS (Deep Dive β€” System Interview)

Beyond MCQ-level. These are asked as discussion questions in the System Interview.


6.1 Process vs Thread β€” Deep Understanding

  • Memory sharing between threads of same process
  • When to use processes vs threads
  • IPC (Inter-Process Communication) mechanisms: pipes, message queues, shared memory, sockets
  • What happens when you play a song and code on a single-core PC β€” explain context switching in detail

6.2 Multicore vs Single Core Processors

  • Why multicore is better β€” true parallelism vs concurrency on single core
  • How OS schedules threads across cores
  • Cache coherence in multicore systems β€” MESI protocol
  • Amdahl's Law β€” speedup limit based on parallelizable fraction

6.3 Structure of a Process

  • Code/Text segment β€” executable instructions
  • Data segment β€” global and static variables (initialized + uninitialized/BSS)
  • Heap β€” dynamically allocated memory (malloc, new)
  • Stack β€” function call frames, local variables, return addresses
  • PCB β€” Process Control Block

6.4 Compiler vs Interpreter

  • Compiler β€” translates entire source code to machine code before execution (C, C++, Java bytecode)
  • Interpreter β€” executes code line by line (Python, JavaScript)
  • JIT (Just-In-Time) Compilation β€” hybrid approach (Java JVM, V8 for JavaScript)
  • Optimization question (actually asked): Given a function called 1000 times in a loop with same behavior, how to improve interpreted code β†’ answer: function call memoization/caching, loop unrolling, inline expansion

7️⃣ SYSTEM DESIGN CONCEPTS


7.1 API Design

  • REST principles β€” stateless, resource-based URLs, proper HTTP methods
  • RESTful API design β€” naming conventions, versioning (/api/v1/)
  • Request/Response format β€” JSON, status codes
  • Authentication β€” API keys, OAuth 2.0, JWT tokens
  • Rate limiting at API level
  • Pagination β€” offset-based, cursor-based

7.2 JWT Authentication (Actually Asked)

  • What JWT is β€” JSON Web Token
  • Structure: Header.Payload.Signature
  • How signing works β€” HMAC or RSA
  • Stateless authentication β€” no server-side session storage
  • Access Token vs Refresh Token
  • Token expiry and renewal
  • Security risks: token theft, XSS, CSRF

7.3 Database Design

  • Schema Design

    • Tables, columns, primary keys, foreign keys
    • Normalization β€” 1NF, 2NF, 3NF, BCNF β€” why and when to denormalize
    • Relationships β€” one-to-one, one-to-many, many-to-many (junction table)
  • Indexing

    • B-Tree index β€” how it speeds up lookups
    • Hash index β€” O(1) but no range queries
    • Composite index β€” column order matters
    • When indexing hurts β€” write-heavy workloads
  • Transaction Isolation Levels

    • Read Uncommitted β€” dirty reads possible
    • Read Committed β€” no dirty reads
    • Repeatable Read β€” no non-repeatable reads
    • Serializable β€” strictest, no phantom reads
    • ACID properties β€” Atomicity, Consistency, Isolation, Durability
  • Query Optimization

    • Explain plan / Query execution plan
    • Avoiding full table scans
    • Proper use of WHERE, JOIN, INDEX

7.4 Caching

  • Why caching β€” reduce latency, reduce database load
  • Caching strategies:
    • Cache-Aside (Lazy Loading) β€” read from cache, if miss, read from DB, update cache
    • Write-Through β€” write to cache and DB simultaneously
    • Write-Behind (Write-Back) β€” write to cache, asynchronously update DB
  • Eviction Policies:
    • LRU (Least Recently Used)
    • LFU (Least Frequently Used)
    • FIFO
    • TTL (Time To Live)
  • Cache invalidation β€” hardest problem in CS
  • Redis / Memcached β€” what they are

7.5 Concurrency in Systems

  • Optimistic Locking β€” assume no conflict, check at commit time (version number)
  • Pessimistic Locking β€” lock the resource before reading/writing
  • Distributed Locks β€” Redlock algorithm
  • Idempotency β€” same request applied multiple times produces same result
    • Why critical in payment systems β€” prevent double charging
    • Implementation: idempotency key stored with each transaction

7.6 Scalability & Reliability

  • Horizontal scaling vs Vertical scaling
  • Load Balancing β€” Round Robin, Least Connections, IP Hash
  • CAP Theorem β€” Consistency, Availability, Partition Tolerance (pick 2)
  • Eventual Consistency β€” what it means, where it's acceptable
  • Retry Mechanisms:
    • Exponential backoff
    • Jitter β€” randomized retry delay to avoid thundering herd
    • Idempotency keys to prevent duplicate processing
  • Circuit Breaker Pattern β€” prevent cascading failures
  • Handling partial failures in distributed systems

7.7 Encryption (Actually Asked)

  • Symmetric encryption β€” AES, same key for encrypt and decrypt
  • Asymmetric encryption β€” RSA, public key + private key pair
  • Hashing β€” SHA-256, bcrypt for passwords (one-way)
  • Digital signatures β€” sign with private key, verify with public key
  • TLS/SSL β€” how HTTPS works

8️⃣ COMPUTER ARCHITECTURE / ORGANIZATION (COA)

  • Number Systems: Binary, Octal, Hexadecimal β€” conversions between them
  • Logic Gates: AND, OR, NOT, NAND, NOR, XOR, XNOR
  • Boolean Algebra: Simplification using K-Map (Karnaugh Map)
  • Combinational Circuits: Adder (half, full), Subtractor, Multiplexer, Demultiplexer, Encoder, Decoder
  • Sequential Circuits: Flip-flops (SR, D, JK, T), Registers, Counters
  • Memory Hierarchy: Registers β†’ Cache (L1, L2, L3) β†’ RAM β†’ Disk β†’ Tape
  • Cache Memory:
    • Direct Mapped β€” each memory block maps to exactly one cache line
    • Fully Associative β€” any block can go in any line
    • Set Associative β€” compromise between the two
    • Cache hit vs Cache miss
    • Write-through vs Write-back policies
  • Pipelining:
    • 5-stage pipeline: IF β†’ ID β†’ EX β†’ MEM β†’ WB
    • Pipeline hazards: structural, data (RAW, WAR, WAW), control
    • Stalling and forwarding (bypassing)
  • Instruction Set Architecture: RISC vs CISC

9️⃣ PUZZLES & LATERAL THINKING

[!NOTE] Puzzles are asked in the System Interview round. They test logical reasoning, not just technical knowledge.

  • Classic CS Puzzles:

    • Burning rope problem (measure 45 minutes with two ropes)
    • 8 balls problem (find heavier ball with minimum weighing)
    • Water jug problem (measure specific amount)
    • Egg drop problem β€” minimum number of trials
    • 25 horses, 5 tracks β€” minimum races to find top 3
    • 100 prisoners and light switch
    • Hat color puzzle
  • Probability Puzzles:

    • Monty Hall problem
    • Birthday paradox
    • Loaded dice, coin flip probability questions
  • Weird/Unconventional Questions (Actually Asked!)

    • How does a toilet flush work? (mechanical engineering β€” 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

πŸ”Ÿ RESUME & PROJECT PREPARATION

[!IMPORTANT] Multiple rounds involve resume discussion and project deep-dives. Be ready to explain and defend every line on your resume.

What to Prepare for Each Project:

  • Problem Statement: What problem does it solve?
  • Architecture: High-level system architecture, components, how they interact
  • Tech Stack: Why you chose each technology, what alternatives you considered
  • Your Contribution: What specifically YOU built (not the team)
  • Challenges: What was the hardest technical challenge? How did you solve it?
  • Scale: How many users / requests / data does it handle?
  • Trade-offs: What design trade-offs did you make and why?
  • What Would You Change: If you rebuilt it, what would you do differently?
  • Measurable Impact: Reduced latency by X%, improved throughput by Y%, reduced error rate by Z%

Cross-Questioning Patterns:

  • "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?"

1️⃣1️⃣ READING & DEBUGGING EXISTING CODE (Final Round Skill)

[!WARNING] In the final onsite round, one candidate was NOT asked to build from scratch β€” they were given someone else's already-implemented design and asked to understand it, find bugs, and add features. This is a real-world skill that most candidates neglect.

11.1 Reading Unfamiliar Code

  • Start with the entry point (main, app.js, index.py) and trace the flow
  • Identify the core data structures and their relationships
  • Map out the class hierarchy and responsibility of each class
  • Look at function signatures before reading implementations β€” understand the contract
  • Identify naming conventions and coding patterns the author uses
  • Build a mental model of data flow: input β†’ processing β†’ output

11.2 Debugging Systematically

  • Reproduce the bug β€” understand the exact input that causes failure
  • Read the error message carefully β€” stack traces tell you WHERE, error messages tell you WHAT
  • Narrow down the scope β€” binary search through the code to find where behavior diverges from expectation
  • Check boundary conditions β€” off-by-one errors, null checks, empty collections
  • Trace state changes β€” print/log variable values at each step
  • Rubber duck debugging β€” explain the code line by line out loud
  • Common bug patterns:
    • Off-by-one errors in loops
    • Null/undefined references
    • Incorrect operator precedence
    • Shallow copy vs deep copy issues
    • Integer overflow
    • Concurrency bugs (race conditions in shared state)

11.3 Adding Features to Existing Code

  • Understand the existing design before modifying anything
  • Identify extension points β€” where the original author intended changes to be made
  • Follow the existing code style and patterns β€” don't introduce a new paradigm
  • Ensure backwards compatibility β€” new features shouldn't break existing functionality
  • Write minimal, focused changes β€” don't refactor the whole codebase
  • Test existing functionality after your changes (regression testing)

11.4 Practice This Skill

  • Pick open-source projects and try to fix real issues
  • Take your friends' code and find bugs in it
  • Practice code reviews β€” read pull requests on GitHub
  • Given a working LLD solution, try to add a new feature without breaking tests

1️⃣2️⃣ COMPETITIVE PROGRAMMING READINESS (Elimination Round 2)

[!NOTE] Some batches include a second elimination round with a CP-style problem (~1500 Codeforces rating). This is harder than typical DSA interview problems.

What Makes CP Different from DSA Interviews

  • Problems are less obvious β€” the underlying pattern is hidden
  • Requires observation and pattern recognition more than knowing a specific algorithm
  • Time pressure is tighter β€” you need to solve quickly
  • Often combines multiple concepts (e.g., graph + greedy + math)

How to Prepare

  • Practice on Codeforces (Div 2 β€” Problems A, B, C) and LeetCode Contest problems
  • Focus on problem decomposition β€” break into smaller pieces, solve each
  • Do multiple dry runs before coding β€” identify the pattern on paper first
  • Practice these CP-heavy topics:
    • Graph problems with tricky constraints β€” modified BFS/DFS, shortest path with conditions
    • Constructive algorithms β€” build a valid answer step by step
    • Greedy with proof β€” why does the greedy choice work?
    • Number theory β€” GCD tricks, modular arithmetic, prime factorization
    • Bit manipulation β€” XOR properties, bitmask DP, subset enumeration
    • Two pointers on sorted/monotonic structures
    • Combinatorics β€” counting valid configurations

Key Strategy During the Round

  • Don't rush to code β€” understand the problem completely first
  • Start with small examples and find the pattern
  • Think out loud β€” the interviewer wants to see your reasoning process
  • If stuck, simplify the problem β€” solve for a smaller case, then generalize

1️⃣3️⃣ BEHAVIORAL & SOFT SKILLS

Communication 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 before submitting
  • Explicitly state time and space complexity after every solution

Mental Endurance

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

HR Questions

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

1️⃣4️⃣ COMMON MISTAKES TO AVOID

❌ Mistakeβœ… What To Do Instead
Start coding without clarifying constraintsAsk about input size, edge cases, expected complexity
Ignore edge cases (null, empty, duplicates)Always list edge cases before coding
Overcomplicate simple solutionsStart simple, add complexity only if needed
Skip complexity analysisAlways state Big-O for time AND space
Can't explain your own code during dry runPractice explaining your logic step by step
No brute force β†’ optimized comparisonAlways mention brute force first, then optimize
Not asking questions when stuckAsk for hints β€” interviewers are usually friendly and want to help
Ignoring OS/CN/Physics for MCQ roundRevise Class 12 Physics + CS fundamentals seriously

1️⃣5️⃣ RECOMMENDED PRACTICE PROBLEMS (From Actual Interviews)

DSA Problems

#ProblemTopicSource
1LRU CacheHashMap + DLLLeetCode 146
2Open the LockBFSLeetCode 752
3Word LadderBFSLeetCode 127
4First Non-Repeating Character in StreamHashing + QueueGFG
5Minimum Swaps to SortGraph (Cycle Detection)GFG
6Detect Cycle in Directed GraphDFSLeetCode 207
7Binary Search on Answer β€” Ship PackagesBinary SearchLeetCode 1011
8Longest Subarray with K DistinctSliding WindowLeetCode 340
9Merge Overlapping IntervalsSorting + GreedyLeetCode 56
10Kth Smallest in Sorted MatrixHeap / Binary SearchLeetCode 378
11Coin ChangeDPLeetCode 322
12Lowest Common AncestorTreesLeetCode 236
13Max Depth of Binary TreeTreesLeetCode 104
14Level Order TraversalBFSLeetCode 102
15Sudoku SolverBacktrackingLeetCode 37

System Design Coding Problems

#ProblemFocus
1Design Rate LimiterToken Bucket / Sliding Window
2Design URL ShortenerBase62, Unique ID
3Payment Gateway SimulatorState Machine, Idempotency
4Design Retry MechanismExponential Backoff, Idempotency Keys
5In-Memory Key-Value StoreHashMap, TTL, Thread Safety
6Thread-Safe SingletonDouble-Checked Locking
7Parking Lot SystemLLD, OOP, Edge Cases
8Tree of Space (Lock/Unlock/Upgrade)M-ary Tree, Multithreading

[!TIP] Priority Order of Preparation:

  1. πŸ”΄ Tree of Space Problem β€” understand it deeply, implement from scratch, make it thread-safe
  2. πŸ”΄ DSA β€” Trees, Graphs, Sliding Window, Hashing, DP, Binary Search
  3. 🟑 OS β€” Process management, Synchronization, Deadlocks, Memory management
  4. 🟑 Multithreading β€” Mutex, Race conditions, Thread-safe design
  5. 🟑 OOP & LLD β€” SOLID, Design Patterns, Parking Lot problem
  6. 🟒 Computer Networks β€” TCP/IP, HTTP, DNS, session vs socket differentiation
  7. 🟒 System Design Concepts β€” Caching, DB design, API design, Idempotency
  8. 🟒 Physics & Math β€” Class 12 formulas, Probability, Discrete Math
  9. πŸ”΅ Projects & Resume β€” Deep understanding of everything on your resume
  10. πŸ”΅ Puzzles β€” Practice logical reasoning puzzles

Good luck with your Juspay placement! πŸš€