Razorpay's DSA rounds — mostly seen in online assessments — draw on graphs/shortest-path, binary-search-on-answer, and knapsack-style dynamic programming, alongside harder digit-DP and cache-design problems for senior roles. The three problems below are real, recently reported (2025) Razorpay questions with full solutions.
There are n servers numbered 1 to n, where server n is the master. Servers are connected by communication links, each taking some time to relay a message. Starting from the master, compute the minimum time for every server to receive the message, or return -1 if some server can never be reached.
Input: n = 4, links = [[4,1,2],[4,2,1],[2,3,3]] (u, v, time)
Output: 4
Master (4) reaches server 2 in 1 unit, then server 3 in 1+3=4 units; server 1 is reached directly from the master in 2 units, so the slowest server (3) sets the answer.
Given a sorted list of distinct cube side lengths, the first and last cubes must stay in place. Remove exactly K of the remaining cubes so that the maximum difference between any two side-by-side cubes (after removal) is as small as possible. Return that minimized maximum gap.
Input: cubes = [1, 3, 4, 9, 10], k = 1
Output: 5
Removing 4 leaves [1,3,9,10] with gaps 2, 6, 1 — worse. Removing 9 leaves [1,3,4,10] with gaps 2,1,6 — worse. Removing 3 leaves [1,4,9,10] with gaps 3,5,1, whose max (5) turns out to be the smallest achievable maximum.
Given a set of items (framed as chip packets), each with a happiness value, a weight, and a cost, find the cheapest combination of items that achieves at least a target happiness total while keeping the combined weight within a given limit.
Input: items = [(happiness=3, weight=2, cost=4), (happiness=5, weight=3, cost=6)], targetHappiness = 5, maxWeight = 3
Output: 6
Picking only the second item alone already reaches the target happiness (5) within the weight cap (3) at the lowest cost (6).
More DSA questions Razorpay has asked recently
These topics were reported in verified 2025 Razorpay assessments. Full problem statements, solutions and explanations for these are part of the Placement-Ready PYQ Kit.
3 more verified DSA questions with full solutions in the full Placement-Ready PYQ Kit
Includes the exact online-assessment context each question appeared in.

