Link: https://leetcode.com/problems/make-string-a-subsequence-using-cyclic-increments/description/ ## 思路 Two pointers ```s1[i]``` is the current char to match. ```s2[j]``` is the character is ```s2``` need to be matched. Each time, we check if one of ```s1[i]```,```s1[i]+1```, ```s1[i]-25``` equals to ```s2[j]```. If they match, ```s1[i]``` is used in the subsequence, ```s2[j]``` get matched, we increment ```i``` and ```j```, If they don't, ```s1[i]``` isn't used in the subsequence, ```s2[j]``` still need to be matched, we only increment ```i```. ## Code ```python= class Solution: def canMakeSubsequence(self, str1: str, str2: str) -> bool: def isNext(a, b): if a == b: return True if a!='z': if ord(a)+1 == ord(b): return True return False return b=='a' j = 0 for i in range(len(str1)): if j==len(str2): return True if str1[i]==str2[j] or isNext(str1[i], str2[j]): j += 1 return j==len(str2) ```