2825. Make String a Subsequence Using Cyclic Increments
You are given two 0-indexed strings
str1
andstr2
.In an operation, you select a set of indices in
str1
, and for each indexi
in 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
true
if it is possible to makestr2
a subsequence ofstr1
by performing the operation at most once, andfalse
otherwise.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 { |