楼主:
dont 2024-12-04 20:38:132825. Make String a Subsequence Using Cyclic Increments
## 思路
用pointer i 纪录目前对应的str2字符
扫str1比对对应的str2字符 有match就i+1
如果指标到底就回传TRUE
## CODE
```python
class Solution:
def canMakeSubsequence(self, str1: str, str2: str) -> bool:
next_char = {}
for i in range(25):
next_char[chr(ord('a') + i)] = chr(ord('a') + i + 1)
next_char['z'] = 'a'
i = 0
for ch in str1:
if str2[i] == ch or str2[i] == next_char[ch]:
i += 1
if i == len(str2):
return True
return False
```