text and pattern of lowercase English letters. At most once, you may pick any set of positions in text and replace each chosen letter with the next one in the alphabet, wrapping around: a → b, b → c, …, z → a.
Return True if this can make pattern a subsequence of text, and False otherwise. A subsequence is what remains of a string after deleting some characters (possibly none) without reordering the rest.text="kpz", pattern="la" → True
Shift k → l and z → a to get "lpa", which contains "la" as a subsequence.
text="mmx", pattern="ny" → True
Shift the first m → n and x → y: "nmy" contains "ny".
text="bd", pattern="f" → False
An f can only come from an e or an f, and text has neither.
text="kpz", pattern="la"
True
Run checks the first 3 tests in your browser. Submit checks all 140 tests on the server, hidden ones included.