Implement ToDo List for AI
Perplexity interview questions · Hard · Coding round · reported 4× · 6 tests
Implement a task system for an AI workflow where some tasks depend on other tasks. Interview reports describe this Perplexity round as a four-part OA-style coding exercise whose tricky second part was handling dependency graphs and cascade failure without timing out on large hidden tests.
Interface
type TaskStatus = 'READY' | 'PENDING' | 'DONE' | 'FAILED';
class AITodoList {
addTask(id: string): boolean;
addDependency(taskId: string, dependsOnId: string): boolean;
markDone(taskId: string): boolean;
markFailed(taskId: string): boolean;
getStatus(taskId: string): TaskStatus | null;
getReadyTasks(): string[];
}
Rules
Run your code with Ctrl+Enter to see results.