Find Maximum Bandwidth

Company: ibm_10sep

Difficulty: medium

Problem Statement

Find Maximum Bandwidth Problem Description A service provider manages n API endpoints, each serving a different functionality, numbered from 1 to n in a row. It has m bandwidth units to allocate among the endpoints, and it wants to give as much bandwidth as possible to endpoint k while meeting all of the following conditions: All m bandwidth units must be allocated. Every endpoint receives a whole number of units, and at least 1 unit. The absolute difference between the bandwidths of any two adjacent endpoints (endpoints i and i + 1 ) is at most 1 . Complete the function findMaximumBandwidths(n, k, m) , which returns the maximum number of units that endpoint k can receive in an allocation satisfying all three conditions. Input Format n k m A single line contains three integers n , k and m : the number of endpoints, the endpoint to maximize, and the total bandwidth. (inferred -- the source shows only the function signature; the three values are read from one line, in this order.) Output