2825. Make String a Subsequence Using Cyclic Increments
You are given two 0-indexed strings
str1andstr2.In an operation, you select a set of indices in
str1, and for each indexiin the set, incrementstr1[i]to the next character cyclically. That is'a'becomes'b','b'becomes'c', and so on, and'z'becomes'a'.Return
trueif it is possible to makestr2a subsequence ofstr1by performing the operation at most once, andfalseotherwise.Note: A subsequence of a string is a new string that is formed from the original string by deleting some (possibly none) of the characters without disturbing the relative positions of the remaining characters.
1 | class Solution { |