Future-Effective Employee Salary
Updated
Problem statement
Simulate an effective-dated employee salary API over a finite ordered sequence of operations. Operation i uses operations[i], employeeIds[i], requestTimes[i], effectiveTimes[i], and salaryValues[i]. Request times are nondecreasing.
Operations
ADD: add a new employee with salarysalaryValues[i]effective atrequestTimes[i]. For this operation,effectiveTimes[i]equalsrequestTimes[i]. Return-1.SCHEDULE: register salarysalaryValues[i]for an existing employee at the future timeeffectiveTimes[i], whereeffectiveTimes[i] > requestTimes[i]. Return-1.GET: query the employee's salary ateffectiveTimes[i]. IgnoresalaryValues[i]. Among versions submitted by earlier operations, return the salary with the greatest effective timestamp not after the query timestamp.
If a later SCHEDULE uses the same employee and effective timestamp as an earlier one, the later value replaces the earlier value for subsequent operations. A GET for an unknown employee, or for a time before that employee's first effective salary, returns -1.
Return one integer for every operation, in input order.
Function
applySalaryOperations(operations: String[], employeeIds: String[], requestTimes: int[], effectiveTimes: int[], salaryValues: int[]) → int[]Examples
Example 1
operations = ["ADD","SCHEDULE","GET","GET","GET"]employeeIds = ["e1","e1","e1","e1","e1"]requestTimes = [1,2,3,3,3]effectiveTimes = [1,10,5,10,12]salaryValues = [100,150,0,0,0]return = [-1,-1,100,150,150]The salary is 100 before time 10 and 150 from time 10 onward.
Example 2
operations = ["ADD","SCHEDULE","SCHEDULE","GET"]employeeIds = ["e","e","e","e"]requestTimes = [1,2,3,4]effectiveTimes = [1,10,10,10]salaryValues = [80,100,120,0]return = [-1,-1,-1,120]The second schedule replaces the first version at effective time 10, so the query returns 120.
Constraints
1 <= operations.length <= 200000.- All five input arrays have the same length.
- Each operation is
ADD,SCHEDULE, orGET. 0 <= requestTimes[i], effectiveTimes[i] <= 10^9, and request times are nondecreasing.- Every
ADDuses a unique nonempty employee ID and haseffectiveTimes[i] == requestTimes[i]. - Every
SCHEDULEnames an existing employee and haseffectiveTimes[i] > requestTimes[i]. 1 <= salaryValues[i] <= 10^9forADDandSCHEDULE.
More Rippling Onsite Interview questions
- Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Delivery Cost TrackerPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Maximum Currency Conversion Along a Simple PathPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Top K Frequent WordsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
- Filter and Sort Scheduled TasksONSITE INTERVIEW · Seen Jul 2026
- LFU Cache with LRU Tie-BreakingPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
Similar questions at other companies
- Bank Accounts with Balance HistoryMeta · OAMeta interview questions
- Versioned ArrayTrueFoundry · PHONE SCREEN
- Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions
- Time-Based Key-Value StoreOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
- Time-Based Key-Value StoreCockroach Labs · PHONE SCREEN · ONSITE INTERVIEW
- Escape Room LeaderboardPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
- Time-Indexed Key-Value StoreTogether AI · ONSITE INTERVIEW
- Insert, Delete, And Get Random In Constant TimeAmazon · ONSITE INTERVIEW
- Insert, Delete, And Get Random In Constant TimeGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
- Globally Versioned Key-Value StoreLyft · ONSITE INTERVIEWLyft interview questions
Rippling interview experiences
- Rippling Senior SWE Full Loop Questions: 1 Experience
- Rippling Experienced SWE Phone Screens: 2 Experiences
- Rippling Design Rounds and Onsites: 17 Experiences (Part 3 of 3)
- Rippling Phone Coding Screens: 14 Experiences (Part 2 of 3)
- Rippling SWE Screens and Loops: 31 Experiences (Part 1 of 3)
- Rippling No-Level Older Reports: 31 Experiences (Part 6 of 6)