Create a LoadBalancer class that has a method to register backend instances. Each backend instance address should be unique, it should not be possible to register the same address two times. Load balancer should accept up to 10 backend instances. The code should be production ready. The Loadbalancer will be released as a library.
Asked in the technical round 1 stage. Java, no Spring, unit tests with JUnit expected. Reported follow-up: implement get() so repeated calls randomly return one registered backend.
For grading, implement the equivalent Python behavior through run_load_balancer(operations). Each operation is register, with an address, or get. Return registration results as true or an error label, and return the selected address for get.
register or get.get operation may return any currently registered address.def run_load_balancer(operations):