Uber | Phone interview
Anonymous User
1070

https://leetcode.com/problems/integer-to-english-words/

Implement load balancer which randomly select server based on their weight . Random should be truly random (of course you still cant gaurantee anything in random but the chances of selecting a server with higher weight should also be high).
E.g: if your servers have weights : 2,3,5 so out of 10 calls 2 calls should go to server 1 , 3 to server 2 and 5 to server 3.

HINT: generate a random from 1 to 10 if the number is 3,4 or 5 then call goes to server 2

Comments (2)