Back to problems

Find Words in String Not in Subsequence

Algorithm · Salesforce · Easy

You are given two strings s and t, each consisting of space‑separated words. The string t is a subsequence of s — that is, every word of t can be matched to a word in s in the same relative order, though the matched words do not need to appear consecutively. A greedy left‑to‑right match is used: as you scan through the words of s, the earliest possible occurrence of the next needed word of t is consumed. After matching the whole of t, any words of s that were not part of…

Checking your access…