AI-Assisted Coding: Filter, Sort and Deduplicate Tasks in a Task Manager
Company: Rippling
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Onsite
Implement filtering, sorting and deduplication for a task manager in an AI-assisted coding round. The coding environment has a built-in AI assistant, and the expected workflow is to explain your approach to the interviewer first, then have the assistant write the implementation, then verify it. The report gives only the task's name, so the shape of a task and the exact rules are open: settle them before handing anything to the assistant.
For concreteness, assume each task is a record with fields such as `id`, `title`, `status`, `priority`, `due_date`, `assignee` and `updated_at`, held in an in-memory list, and that some fields can be missing on some tasks. Replace these with the fields the provided code actually uses.
### Clarifying Questions
- Which fields does a task have, and which of them must be filterable and sortable?
- Do conditions combine only with AND, or also with OR? Is a text condition on the title a case-insensitive substring match or an exact match?
- What makes two tasks duplicates: the same `id`, or the same content (for example the same title, assignee and due date) under different ids? When duplicates differ, which copy is kept?
- Are filter, sort and dedupe independent calls that the caller chains in any order, or one pipeline with a fixed order?
- Should the functions return new lists and leave the input unchanged?
- Where do tasks with a missing due date or priority go when sorting on that field?
### Part 1 — Filter
Return only the tasks that match a set of conditions, for example "status is open, the assignee is one of two people, due before a given date, and the title contains a keyword".
```hint Make conditions values
Think about representing each condition as a small value or function, so that adding a new kind of condition or combining two of them does not mean editing one long chain of if-statements.
```
#### What This Part Should Cover
- The kinds of condition supported (equality, membership, ranges, text) and how they combine
- Behavior when the filtered field is missing on a task
- One pass over the input, with the input left unchanged
### Part 2 — Sort
Order tasks by one or more keys, each with its own direction, for example priority descending, then due date ascending.
```hint Ties and gaps
Ask what order two tasks should have when they are equal on every key, and where a task with no due date belongs.
```
#### What This Part Should Cover
- Multi-key comparison with a direction per key
- A deterministic result for full ties and a fixed position for missing values
- Time complexity of the approach
### Part 3 — Deduplicate
Remove duplicate tasks so that each logical task appears once.
```hint Define the duplicate first
Decide what key identifies a duplicate and which copy survives before choosing a data structure.
```
#### What This Part Should Cover
- An explicit duplicate key (id or normalized content)
- A survivor rule, and whether the original order is preserved
- Linear expected time, and where dedupe sits relative to filtering when both are applied
### Part 4 — Hand off to the AI assistant and verify
Once the approach is agreed, have the built-in assistant implement it, then show the interviewer that the result is correct by running test cases.
```hint Specify, then check
Think about what the assistant must be told so that it cannot settle a rule differently from what you agreed, and which test would expose each such guess.
```
#### What This Part Should Cover
- A precise instruction to the assistant: data model, function signatures, and the tie, missing-value and survivor rules
- Reading the generated code against the agreed rules, not only running it
- Targeted test cases for each rule and edge case
### What a Strong Answer Covers
- Rules agreed with the interviewer and an approach explained clearly before any code is generated
- Composable filters, a stable multi-key sort with defined handling of missing values, and an explicit dedupe key and survivor rule
- A justified order of operations when the three are combined
- Edge cases: empty input, every task filtered out, missing fields, input left unchanged
- Effective use of the assistant: precise instructions, critical review, and tests that would catch a wrong assumption
- Time and space complexity of each operation
### Follow-up Questions
- The list grows to millions of tasks and the same few filters run constantly. What would you index or precompute?
- Two tasks with different ids share a title and due date but have different assignees. Are they duplicates, and how would you make the rule configurable?
- How would you page through filtered, sorted results so that a page does not shift when new tasks arrive?
- The assistant's code passes your tests but puts tasks with no due date first. Which test would have caught it, and how would you have worded the instruction?
Overview: An AI-assisted coding exercise for a task manager: explain an approach, then have a built-in AI assistant implement filtering, multi-key sorting and deduplication of tasks. It tests composable filter design, stable sorting with missing values, duplicate keys and survivor rules, and verifying generated code with targeted tests.
Read the full Rippling Software Engineer interview experience this question came from