This is a verified interview question from Phonepay. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "The SLA-Constrained Data Pipeline - Phonepay Online Assessment MNNIT Allahabad" covers key patterns like Arrays.
"You are a Cloud Infrastructure Architect tasked with routing a critical, continuous data stream from a source microservice to a destination microservice across a global network. The network consists of n microservices (labeled 0 to n - 1). They are connected by a series of bidirectional network links, where connections[i] = [u, v, latency] indicates a two-way network cable between microservice u and microservice v that takes latency milliseconds to traverse. Routing data through any microservice requires CPU cycles, which incurs a specific processing cost. You are given an array compute_costs of length n, where compute_costs[i] is the cost to process data at microservice i. (Note: Processing data at the starting source and the final destination also incurs their respective compute costs). The Business Requirement: To meet the Service Level Agreement (SLA) for your enterprise customer, the total network latency of the path from the source to the destination must not exceed max_latency. Given the network topology, return the minimum total compute cost required to route the data from the source to the destination without violating the SLA. If it is impossible to reach the destination within the allowed latency, return -1. Input Format Line 1: an integer max_latency — the maximum total path latency allowed by the SLA. Line 2: an integer n — the number of microservices (nodes are labeled 0 .. n-1). Line 3: an integer m — the number of bidirectional network links (connections). Next m lines: three space-separated integers u v latency describing one link. (If m = 0, no such lines appear.) Next line: n space-separated integers — compute_costs[0 .. n-1]. Last line: two space-separated integers — source and destination. Output Format A single integer: the minimum total compute cost of an SLA-compliant path from source to destination, or -1 if no such path exists."
Join thousands of developers practicing for Phonepay.