Round 1
Questions: You are tasked with calculating the maximum number of concurrent calls for customers using HubSpot's calling capabilities. You need to process call records provided via an HTTP GET endpoint and return the results in a specific JSON format to a POST endpoint.
The call records are structured as follows:
{ "customerId": 123, "callId": "2c269d25-deb9-42cf-927c-543112f7a76b", "startTimestamp": 1707314726000, "endTimestamp": 1707317769000 }
You need to determine the maximum number of concurrent calls for each customer for each day and format the response as:
{ "results": [ { "customerId": 123, "date": "2024-02-07", "maxConcurrentCalls": 1, "timestamp": 1707314726000, "callIds": [ "2c269d25-deb9-42cf-927c-543112f7a76b" ] } ] }
The date must be in the format YYYY-MM-DD, and the timestamp should be a UNIX timestamp in milliseconds.
Follow-up Question
- What challenges did you face while implementing the solution?
- How did you ensure that your solution passed all test cases?
Candidate's Approach
The candidate implemented a solution in Python that involved the following steps:
- Fetching call records from the provided GET endpoint.
- Organizing call records by customer ID and splitting calls that span multiple dates.
- Calculating the maximum number of concurrent calls for each customer on each date.
- Formatting the results according to the specified JSON structure and sending them to the POST endpoint.
However, the candidate faced issues with passing all test cases, which ultimately led to a rejection.
Interviewer's Feedback
The interviewer noted that while the candidate's approach was logical, there were issues with handling edge cases, particularly with calls that spanned multiple dates. The candidate was encouraged to review the handling of timestamps and ensure that all test cases were considered.