As reported: Salesforce SMTS online assessment (Dec 2024), question 1 of 2.
s and t are sentences: words separated by single spaces. The words of t form a subsequence of the words of s. Return the words of s that are not part of that subsequence, in the order they appear in s.
Match t against s from left to right, taking each word of t at its earliest possible position. Matching is case-sensitive.
Example 1
s = "LeetCode is very much amazing and good"
t = "LeetCode is amazing good"
Output: ["very","much","and"]
Example 2
s = "I am using HackerRank to improve programming"
t = "am HackerRank to improve"
Output: ["I","using","programming"]
Constraints: 1 ≤ words in s ≤ 10^5; 0 ≤ words in t < words in s; each word has 1–15 letters or '-'.
Code runner format: one JSON value per line: s, then t. Implement missingWords(s, t); the harness prints the list.