Ethos Life OA Question

ethos life logo
ethos life
Ongoing
March 2, 20252 reads

Summary

I encountered a challenging server load balancing problem during my online assessment for Ethos Life. The problem required careful consideration of manual offloading and an automated management tool to minimize operations.

Full Experience

During my online assessment with Ethos Life, I was presented with a complex algorithmic problem related to server load balancing. The task was to minimize the number of times a specific management tool was used, given that I could also manually offload tasks from a limited number of servers. This problem required a strategic approach to combine both methods efficiently.

Interview Questions (1)

Q1
Minimize Server Tool Operations for Load Balancing
Data Structures & Algorithms

Problem Statement

You are given a set of servers, each with a different workload represented as an integer in an array serverLoad. The goal is to balance the server workloads by offloading tasks.

You can offload tasks in two ways:

  1. Manually Offloading – You can manually offload tasks from at most k servers.
  2. Using the Management Tool – This tool:
    • Identifies the server with the highest workload, denoted as L.
    • Offloads tasks from all servers with a workload strictly greater than L/2 in a single operation.
    • Each time you use the tool, it incurs a resource cost.

Your task is to minimize the number of times the tool is used while ensuring the workloads are balanced. Return the minimum number of times the tool must be operated.

Example

Input:

serverLoad = [16, 12, 18, 10, 12]
k = 2

Output:

1
Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!