Pick the Words Most Likely Forgotten for a Practice Session

Last updated: November 29, 2026

Quick Overview

Each word a learner has studied has a last-practiced time and a half-life in days, and predicted recall is $2^{-\Delta/h}$. Return the k words with the lowest predicted recall at the current time, lowest first.

Duolingo
Coding & Algorithms
Software Engineer
Duolingo
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Each word a learner has studied has a last-practiced time and a half-life in days, and predicted recall is $2^{-\Delta/h}$. Return the k words with the lowest predicted recall at the current time, lowest first.

Duolingo's practice features lean on spaced repetition, and its published half-life regression model predicts recall as an exponential decay in time since last practice. A technical screen might use this to test top-k selection with a heap while checking that the candidate understands the scoring function.

What the Interviewer Expects
  • Computes recall correctly from elapsed time and half-life
  • Uses a size-k heap rather than sorting all words when k is small
  • Gets the heap direction right for keeping the k smallest
  • Defines deterministic tie breaking
  • Discusses k larger than the vocabulary and zero or negative half-lives
Key Topics to Cover
Heaps
Top-k selection
Spaced repetition
Exponential decay
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • If half-lives change only on practice, can you avoid recomputing scores for every word?
  • How would you add a minimum spacing so a word just practiced is never picked?
  • How would you mix in some new words so sessions are not all review?
  • How would this run server-side for millions of learners at session start?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: list of (word, last_seen, half_life) with times in days, now, and k. Output: up to k words sorted by ascending predicted recall p = 2^(-(now - last_seen)/h). Ties sorted by word for sta...

High-Level Design

Maintain a heap of the k lowest-recall words seen so far. Python has a min-heap, so store (-p, word): the root is then the highest recall currently kept, which is the one to evict when a lower-recal...


Submit Your Answer
Markdown supported

Related Questions