Employee Training Status
Updated
Problem statement
A training requirement service stores due days for required employees and completion days for employees who finished the training. Given a shared checkDay, return one status for every employee in queryEmployeeIds.
Build the requirement and completion records from the parallel input arrays, then classify each queried employee using these rules:
- If the employee does not appear in
requiredEmployeeIds, return"NOT_REQUIRED". - If the employee has a completion day less than or equal to
checkDay, return"COMPLETED". Completion takes precedence even when it happened after the due day. - If the employee is required, has not completed by
checkDay, andcheckDayis greater than the due day, return"OVERDUE". - Otherwise, return
"PENDING". An incomplete training is still pending on its due day.
Return the statuses in the same order as queryEmployeeIds; repeated query IDs produce repeated output entries.
Function
trainingStatuses(queryEmployeeIds: String[], requiredEmployeeIds: String[], dueDays: int[], completedEmployeeIds: String[], completionDays: int[], checkDay: int) → String[]Examples
Example 1
queryEmployeeIds = ["amy","ben","cy","dia"]requiredEmployeeIds = ["amy","ben","cy"]dueDays = [10,12,8]completedEmployeeIds = ["amy","cy"]completionDays = [9,13]checkDay = 12return = ["COMPLETED","PENDING","OVERDUE","NOT_REQUIRED"]amy completed before the check day. ben is incomplete exactly on the due day, so the status is pending. cy has a future completion record and is already past due on the check day. dia is not required.
Example 2
queryEmployeeIds = ["late","future"]requiredEmployeeIds = ["late","future"]dueDays = [3,20]completedEmployeeIds = ["late"]completionDays = [8]checkDay = 10return = ["COMPLETED","PENDING"]A late completion is still completed by the check day. The second employee has not reached the due day.
Constraints
requiredEmployeeIds.length == dueDays.length.completedEmployeeIds.length == completionDays.length.- Every employee ID is a non-empty string. IDs are unique within
requiredEmployeeIdsand withincompletedEmployeeIds; query IDs may repeat. - All due days, completion days, and
checkDayare nonnegative integers. - A completion record may name an employee who is not required; that employee still resolves to
"NOT_REQUIRED".
More Vanta interview questions
Similar questions at other companies
- Count Distinct Underwriting PII ValuesAffirm · PHONE SCREEN · ONSITE INTERVIEWAffirm interview questions
- Bounded IPv4 FilterAmazon · PHONE SCREEN
- SimpleRDD Multiset IntersectionDatologyAI · PHONE SCREEN
- Vehicle Maintenance Event ReadinessWaymo · PHONE SCREENWaymo interview questions
- Summarize the Latest Event for Each DeviceOneTrust · PHONE SCREEN
- Project JSON Fields into a Target FormatBooking.com · PHONE SCREEN
- Select Object by Key ExtremeBridge · PHONE SCREENBridge interview questions
- Group Names by DepartmentMastercard · PHONE SCREENMastercard interview questions
- Badge Records Without a MatchWhatNot · PHONE SCREENWhatNot interview questions
- AI Role: Collection with Add and Remove OperationsApple · PHONE SCREENApple interview questions