FastPrepFilter, Sort, and Deduplicate Scheduled Tasks
Problems/Filter, Sort, and Deduplicate Scheduled Tasks

Filter, Sort, and Deduplicate Scheduled Tasks

Rippling logoRippling● MediumFULLTIMEPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Several Rippling reports describe this task-manager exercise. Earlier phone-screen and onsite reports named its filter, sort and deduplicate parts. They added that removing a parent task also removes all of its descendants. They listed the task fields, the duplicate key of description plus due date, dropping finished tasks, and printing each child right after its parent. A November 2026 phone-screen report then gave the exact rules. Keep only tasks that nobody is assigned to and that are not done. Order by earlier due date with a missing due date (-1) last, then priority tasks first, then earlier creation time. Print each task as its ID and description, adding the parent's ID and description when it has a parent. Its second part printed child tasks under their parent with the same filter and order. The third part was not reached.

We chose these: the first task in input order with a given description and due date is kept and later copies are dropped, even when the kept task is filtered out afterwards. A task whose parent is removed is removed too. A full tie keeps input order. Tasks arrive as parallel arrays with string IDs and an empty string for no assignee or no parent. The answer is the printed lines in order, with each task's whole subtree right after it. The limits and examples are ours.

Our version is about 85% the same as the reported questions.

You are given a batch of tasks as parallel arrays. Position i in every array belongs to task i:

  • taskIds[i] is the task's unique ID.
  • descriptions[i] is its description.
  • dueDates[i] is its due date. -1 means it has no due date.
  • isPriority[i] is its priority flag.
  • createdDates[i] is its creation time.
  • assignees[i] is its assignee. An empty string means nobody is assigned.
  • completed[i] is its done flag.
  • parentIds[i] is the ID of its parent. An empty parent ID marks a root task.

Print the open, unassigned tasks as a hierarchy. Apply these phases in order:

  1. Deduplicate: tasks with the same exact pair (description, due date) are duplicates. Keep only the first one in input order and drop the others, even if the kept one is removed in the next phase.
  2. Filter: remove every remaining task that is done or has an assignee. A task also survives only if its parent survives, so removing a task removes its entire subtree, including the children of dropped duplicates.
  3. Order: compare tasks by due date, earliest first, where a task with no due date (-1) comes after every task that has one. Break ties by putting priority tasks first, then by earlier creation time, then by earlier input position.
  4. Print the hierarchy: sort the surviving root tasks and every list of surviving siblings with that order. Print each root, then its whole surviving subtree in preorder, before the next root.

Each printed line is "id: description" for a root task and "id: description: parentId: parentDescription" for a task with a parent, using the task's own parent. Return the printed lines in order.

Function

orderHierarchicalTasks(taskIds: String[], descriptions: String[], dueDates: long[], isPriority: boolean[], createdDates: long[], assignees: String[], completed: boolean[], parentIds: String[]) → String[]

Examples

Example 1

taskIds = ["t1","t2","t3","t4","t5","t6"]descriptions = ["Write docs","Fix login","Plan sprint","Review PR","Update deps","Add tests"]dueDates = [5,5,-1,2,8,5]isPriority = [false,true,true,false,false,false]createdDates = [3,9,1,7,2,1]assignees = ["","","","maria","",""]completed = [false,false,false,false,true,false]parentIds = ["","","","","","t1"]return = ["t2: Fix login","t1: Write docs","t6: Add tests: t1: Write docs","t3: Plan sprint"]

t4 has an assignee and t5 is done, so both are dropped. Among the roots, t1 and t2 share due date 5, and the priority task t2 goes first. t3 is a priority task but has no due date (-1), so it comes after every task with a due date. Child t6 follows its parent t1 and names it.

Example 2

taskIds = ["a","b","c","d","e","f","g"]descriptions = ["Sync data","Sync data","Clean up","Deploy","Notify team","Rollback","Audit"]dueDates = [4,4,6,3,1,2,2]isPriority = [false,false,false,false,false,false,false]createdDates = [10,11,12,13,14,15,5]assignees = ["","","","","","",""]completed = [true,false,false,false,false,false,false]parentIds = ["","","a","","d","d","d"]return = ["d: Deploy","e: Notify team: d: Deploy","g: Audit: d: Deploy","f: Rollback: d: Deploy"]

b repeats the pair (Sync data, 4) of the earlier task a, so b is dropped even though a is done. a is then removed for being done, which also removes its child c. Under d, the children are ordered by due date, and g and f tie on due date 2 with no priority, so the earlier created date puts g first.

Example 3

taskIds = ["p","q","p1","p2","p21","p22"]descriptions = ["Release","Hotfix","Freeze","Tag build","Sign build","Upload"]dueDates = [-1,9,-1,7,7,6]isPriority = [false,false,true,false,true,false]createdDates = [1,2,3,4,5,6]assignees = ["","","","","",""]completed = [false,false,false,false,false,false]parentIds = ["","","p","p","p2","p2"]return = ["q: Hotfix","p: Release","p2: Tag build: p: Release","p22: Upload: p2: Tag build","p21: Sign build: p2: Tag build","p1: Freeze: p: Release"]

Root q has a due date and p does not, so q prints first. Inside p, child p2 has a due date and comes before p1, which has none even though it is a priority task. Each task's whole subtree prints right after it: p22 (due 6) comes before p21 (due 7) under p2, and then p1 follows.

Constraints

  • 0 <= taskIds.length <= 2000
  • All eight arrays have the same length.
  • Task IDs are unique strings of 1 to 20 ASCII letters, digits, hyphens, or underscores.
  • Each description has 1 to 50 characters: words of ASCII letters and digits separated by single spaces, with no leading or trailing space. Duplicate matching is exact and case-sensitive.
  • Each due date is -1 (no due date) or an integer from 0 to 10^12.
  • 1 <= createdDates[i] <= 10^12
  • Each assignee is the empty string (unassigned) or 1 to 20 ASCII letters and digits.
  • Each parent ID is empty (a root task) or the ID of another task, and the parent links form a forest (no cycles).

More Rippling Phone Screen questions

  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
  • Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
  • Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
  • Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Median Across N Sorted ArraysPHONE SCREEN · Seen Oct 2026
  • Delivery Cost TrackerPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Group AnagramsAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Count Zero Request ServersSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Longest Consecutive SequenceJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions
  • Top K Frequent Elements with a Recency TiebreakSwiggy · PHONE SCREEN
  • Pins Violation Log QueriesPinterest · PHONE SCREENPinterest interview questions
  • Group AnagramsWorkday · PHONE SCREEN
  • Build a Task and Subtask HierarchyStripe · PHONE SCREENStripe interview questions
  • Find All Points Within a RadiusGoogle · PHONE SCREENGoogle interview questions

Interview reports that mention this question

  • Rippling Experienced SWE Phone Screens: 2 Experiences
  • Rippling No-Level Screens and Loops: 18 Experiences (Part 4 of 6)
  • Rippling No-Level Design, Screens: 30 Experiences (Part 2 of 6)
  • Rippling SWE Interviews, No Level: 156 Experiences (Part 1 of 6)
  • Rippling Senior SWE Onsite Loops: 15 Experiences (Part 6 of 12)
  • Rippling Rules and Task Screens: 22 Experiences (Part 3 of 12)
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public String[] orderHierarchicalTasks(String[] taskIds, String[] descriptions, long[] dueDates, boolean[] isPriority, long[] createdDates, String[] assignees, boolean[] completed, String[] parentIds) {
        // Write your code here.
    }
}
Checking account…