← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Design a distributed system that supports adding integer data on multiple workers and can return the current mode (most frequent integer) across all workers even when workers fail. You must implement two primitives:
The system must be resilient: after any sequence of add/remove operations, find_mode() must immediately return the correct mode without re-scanning all surviving data from scratch. You may assume that worker_ids and values are both 32-bit signed integers and that the total number of distinct integers in the system at any moment is ≤ 10^5.