GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Ask a Question


Start Coding Today




Data Structures


Interview Experiences

C Programming

C++ Programming

Java Programming



Customer Service Capacity

Given that current number of customer care agents is X. Determine how many more people would be needed, to make sure that customers would not have to wait during peak hours (i.e. that we dont have more phone calls than we have customer service executives).

Input: The first Iine contains the current number of customer service executives X. The second Iine contains an Integer N, which Is the number of data points in the data set. The next N lines are whltespace-separated pairs of timestamps (a timestamp is an Integer that represents seconds since the epoch). On each line, the first time is the time when the call was started, and the second one Is when that call ended.

Output: A single integer, representing the number of additional customer service executives that we would need to employ, to cover the call volume during peak times. If the current coverage is already sufficient, that print 0.

Sample input:



1481122000 1481122020

1481122000 1481122040

1481122030 1481122035

Sample output 1

Explanation: The first call overlaps with the second call. The third call also overlaps with the second call. However, the first and the third call are not overlapping with each other. This means that we have at most 2 concurrent calls. Given that there is only one customer service executive, we would need to employ one more customer service executive, to be able to ensure that all customer phone calls can be handled as soon as they arrive.

asked Mar 27 by Lokesh Agrawal 1