Duolingo Coding Interview Questions
25 Duolingo coding interview problems with full optimal solutions — 17 easy, 6 medium, 2 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Duolingo interviewer values, and a FAQ section.
- #3mediumfoundational
3. Longest Substring Without Repeating Characters
Find the longest contiguous substring with all unique characters — the sliding-window pattern Duolingo applies when scanning a learner's typed sentence for the longest unique-token run to validate a free-form translation exercise.
- #49mediumfoundational
49. Group Anagrams
Cluster strings that are anagrams of each other into groups — the hash-keying technique Duolingo's vocabulary engine uses to bundle conjugation variants of the same root word into a single learning card set.
- #127mediumfoundational
127. Word Ladder
Find the shortest transformation sequence from one word to another by changing one letter at a time — the BFS word-graph search that mirrors how Duolingo's word-learning path finds the fewest morphological steps between a learner's current vocabulary and a target word.
- #208mediumfoundational
208. Implement Trie (Prefix Tree)
Build a trie that supports insert, search, and prefix-match — the core data structure powering Duolingo's autocomplete, spell-check hints, and word-bank prefix filtering that learners interact with on every vocabulary exercise.
- #212hardfoundational
212. Word Search II
Find all words from a dictionary that exist as paths in a letter grid — the trie-pruned DFS that Duolingo's word-puzzle feature uses to validate which target vocabulary words a learner can trace through a randomly generated tile board in one traversal.
- #242easyfoundational
242. Valid Anagram
Determine whether two strings are anagrams of each other — a pattern that mirrors how Duolingo's vocabulary engine checks if a learner rearranged the correct letters to spell a target word, making character-frequency maps the go-to tool.
- #295hardfoundational
295. Find Median from Data Stream
Maintain a running median as integers arrive one at a time using two heaps — the same dual-priority-queue structure Duolingo's spaced-repetition scheduler uses to track the median session-difficulty score across an evolving stream of lesson completions.
- #322mediumfoundational
322. Coin Change
Find the minimum number of coins to reach an exact amount — the bottom-up DP pattern that directly models Duolingo's streak-recovery logic, where learners spend XP gems in minimum moves to restore a broken streak to its target length.
- #347mediumfoundational
347. Top K Frequent Elements
Return the k most frequent elements from an array — the heap or bucket-sort technique Duolingo's recommendation engine uses to surface the k words a learner encounters most so they can be promoted to the next spaced-repetition review slot.
- #383easyfoundational
383. Ransom Note
Check whether one string's characters can be constructed from another — the same character-budget check Duolingo's hint system runs to decide if a learner's remaining tile set can form the target phrase without reshuffling the tile pool.
- #448easyfoundational
448. Find All Numbers Disappeared in an Array
Identify which values from 1–n are absent in an array of n integers — the same gap-detection logic Duolingo's streak-repair system uses to spot which daily XP records are missing from a learner's history without a second data structure.
- #977easyfoundational
977. Squares of a Sorted Array
Return the squares of a sorted array in non-decreasing order — the kind of merge-from-ends two-pointer move that underpins Duolingo's leaderboard re-ranking, where positive and negative score deltas must be combined into a single sorted result efficiently.
- #1easyfoundational
1. Two Sum
Given an array of integers and a target, return indices of two numbers that sum to target.
- #2easyfoundational
2. Valid Parentheses
Determine if an input string of brackets is correctly opened and closed.
- #3easyfoundational
3. Merge Two Sorted Lists
Merge two sorted linked lists into one sorted list.
- #4easyfoundational
4. Remove Duplicates from Sorted Array
Remove duplicates from a sorted array in-place and return the new length.
- #5easyfoundational
5. Remove Element
Remove all occurrences of a value from an array in-place.
- #6easyfoundational
6. Search Insert Position
Find the index where target appears or should be inserted to keep the array sorted.
- #7easyfoundational
7. Maximum Subarray
Find the contiguous subarray with the largest sum.
- #8easyfoundational
8. Plus One
Add one to a non-negative integer represented as an array of digits.
- #9easyfoundational
9. Merge Sorted Array
Merge two sorted integer arrays into nums1 in-place.
- #10easyfoundational
10. Binary Tree Inorder Traversal
Return the inorder traversal of a binary tree's node values.
- #11easyfoundational
11. Same Tree
Check whether two binary trees have identical structure and values.
- #12easyfoundational
12. Symmetric Tree
Determine if a binary tree is a mirror of itself around its center.
- #13easyfoundational
13. Maximum Depth of Binary Tree
Return the depth of the deepest leaf in a binary tree.