Lost Messages
Reported by candidates from Superhuman's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
You've got a Superhuman OA in your inbox, reported April 2026, and this one's about finding missing words between two strings. A candidate gets 'sent' and 'received' messages, and you need to return which words dropped out while preserving order. It's not a hard algorithmic problem, but the implementation matters. StealthCoder sits in the background during your OA and can read this problem and give you the pattern instantly if you blank on the logic.
The problem
You are given two strings: Some words may be missing from received. It is guaranteed that all words in received appear in the same relative order as they do in sent. Return all words that appear in sent but do not appear in received, preserving their original order. Function Description Complete the function lostFragments in the editor below. lostFragments has the following parameters: Returns
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick here is understanding that 'received' is a subsequence of 'sent'. You're not doing fuzzy matching or searching for substrings. You iterate through 'sent', and for each word, check if it appears next in 'received' using a pointer. If it matches, advance the received pointer. If it doesn't match, add it to your result. Common pitfall: trying to use a set or hash table and losing order, or getting confused about what 'relative order' means. It means the order in received mirrors sent, just with gaps. Use two pointers. O(n) time, no exotic data structures needed. When you're live and panicking during the OA, StealthCoder reminds you it's a two-pointer problem masquerading as a string problem.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Lost Messages cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Superhuman's OA.
Superhuman reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Lost Messages FAQ
Is this really just two pointers?+
Yes. One pointer walks through sent, one tracks where you are in received. When sent[i] matches received[j], increment both. Otherwise, add sent[i] to your missing list and only increment the sent pointer. That's the entire algorithm.
Do I need to split the strings into words?+
The problem statement cuts off, but based on the context 'words may be missing', yes, you split on whitespace or whatever delimiter is in the test. Compare word by word, not character by character.
What if a word appears multiple times in sent?+
Your two-pointer logic handles it. If 'hello' appears three times in sent but only twice in received, the third occurrence won't match anything in received and gets added to lost. Order is preserved naturally.
Can I use a set to check if words are in received?+
You could, but it loses the subsequence property. You'd mark words as used and miss the relative order constraint. Two pointers is cleaner and prevents bugs under interview pressure.
How do I test this locally before the OA?+
Write a few test cases: sent='the quick brown fox', received='the brown fox' should return 'quick'. sent='a b c d', received='a c' should return 'b d'. If you get those right, your logic is sound.