Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Answer Call Center Math

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Answer Call Center Math. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

During a one-hour interval monitored through Cyara CX Assurance, a call center has x agents. y percent of the agents answer exactly one call each. Of the remaining agents, half answer two calls each and the other half answer no calls.

Implement a function that returns the total number of answered calls. Return -1 when the distribution is impossible because the one-call group is not a whole number of agents or the remaining agents cannot be split equally.

Formal Specification

Implement calls_answered(x, y), where x is an integer agent count and y is an integer percentage from 0 through 100. Return an integer representing the total calls answered, or -1 for an invalid distribution. Do not use floating-point arithmetic.

Constraints

  • 1 <= x <= 10^12
  • 0 <= y <= 100
  • Return -1 if x * y is not divisible by 100
  • Return -1 if the remaining agent count is odd

Function Signature

def calls_answered(x, y):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output