Company: Bloomberg

Difficulty: medium

Problem Statement

You are given an undirected network of n servers labeled from 0 to n - 1. Each server belongs to one of the following types: Type 1 — The server has sufficient memory and requires no assistance. Type 2 — The server has an unlimited memory reserve and can continuously provide memory to other servers. Type 3 — The server has insufficient memory and must receive memory from a Type 2 server to become stable. The network is represented by an edge list where each edge connects two directly connected servers. At time 0, every Type 2 server starts distributing memory simultaneously. During each second: A server that has already received memory can forward it to all of its directly connected neighbors. Memory propagates across one edge per second. A Type 3 server becomes stable immediately upon receiving memory. Type 1 servers do not need memory themselves, but they can relay memory to neighboring servers. Return the minimum number of seconds required for every Type 3 server to become stable. I

More Bloomberg OA questionsInterview experiences