Back to problems

Random IP from Load Balancer

Algorithm · Apple · Medium

Randomly Selecting an IP from a Load Balancer Problem Overview You are implementing the request-distribution component of a load balancer. Given backend IP addresses, choose an address for each request using the probability rule specified for that part. There are two parts. The first requires equal-probability selection. The follow-up introduces weighted selection, which is the main focus of the interview. Part 1: Uniform Random IP Problem Statement Given a list of IP…

Checking your access…