Missing Words
Updated
Problem statement
You are given two sentences s and t. Each sentence contains words separated by single spaces, with no leading or trailing space. The words of t form a case-sensitive subsequence of the words of s: they appear in the same order, but they do not need to be adjacent.
Return the words of s that are missing from t, preserving their original order.
Function
missingWords(s: String, t: String) → List<String>Examples
Example 1
s = "I am using HackerRank to improve programming"t = "am HackerRank to improve"return = ["I", "using", "programming"]Matching the four words of t leaves I, using, and programming unmatched in s.
Example 2
s = "I love programming"t = "I love programming"return = []Every word is matched, so no words are missing.
Example 3
s = "one two one three"t = "one one"return = ["two", "three"]The two occurrences of one must be matched in order, leaving the intervening and trailing words.
Constraints
1 <= t.length() <= s.length() <= 10^6.- Both strings contain only English letters and single spaces between words.
- Every word has length from 1 through 15.
- The words of
tare guaranteed to be a subsequence of the words ofs. - Matching is case-sensitive.
More Airbnb Online Assessment questions
- In-Memory File SystemOA · Seen Nov 2026
- Task Management SystemOA · Seen Nov 2026
- Recipe Management SystemOA · Seen Nov 2026
- Progressive Banking SystemOA · Seen Nov 2026
- Credit Accounts with Scheduled TransfersOA · Seen Oct 2026
- Parcel Attribute Store with TTLOA · Seen Oct 2026
- Parcel Event TrackingOA · Seen Oct 2026
- Median Home Price by CityOA · Seen Sep 2026
- Worker Management (Promotion Track), Part 4: Full-Shift Double PayOA · Seen Sep 2026
- Worker Management (Promotion Track), Part 3: Promotions and SalaryOA · Seen Sep 2026
Similar questions at other companies
- Rearrange String by Alternating EndsHudson River Trading · OAHudson River Trading interview questions
- Alternate String EndsCapital One · OACapital One interview questions
- Run-Length String CompressionSalesforce · OASalesforce interview questions
- Minimum Changes for Palindromic BlocksCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
- Count Binary SubstringsMicrosoft · OAMicrosoft interview questions
- Check a Repeated String as a SubsequenceQuince · OAQuince interview questions
- Reverse String In PlaceThe Walt Disney Company · OA · PHONE SCREENThe Walt Disney Company interview questions
- Lost MessagesSuperhuman · OASuperhuman interview questions
- Reverse a StringFlexTrade · OAFlexTrade interview questions
- Missing WordsVanguard · OAVanguard interview questions
Airbnb interview experiences
- Airbnb OA · November 2026
- Airbnb Campus and Full-Time SWE OA / Interviews: 9 Experiences
- Airbnb Intern Phone Interviews: 21 Experiences (Part 7 of 7)
- Airbnb Intern OA and Phone Screens: 17 Experiences (Part 6 of 7)
- Airbnb Intern OA and Onsite Rounds: 16 Experiences (Part 5 of 7)
- Airbnb Intern OA, Diplomacy Game: 19 Experiences (Part 4 of 7)