Google Interview Question
Anonymous User
1193

Find the richest person in the city

A city has N Banks, and people in the city has savings in the banks. Each bank returns the list of customers and savings amount sorted in descending order. Find the richest person in the city.

e.g
In bank1
cust1 200
cust2 100
cust3. 50

In bank 2
cust3 2000
cust1 150

In bank 3
cust5 8000
cust1 250

Assumptions:

  1. All entries are > 0
  2. customer has same name in all banks
Expected O/p: The result should be `cust5`
Should be best optimal solution.
Should be less < O(M*N) [M = Number of banks,  N = Number of Customers]
Comments (4)