leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2825.cpp (381B)


0 class Solution { 1 public: 2 bool canMakeSubsequence(string str1, string str2) { 3 int i = 0, j = 0; 4 5 while (i < size(str1) && j < size(str2)) { 6 if (str1[i] == str2[j] || str1[i] + 1 == str2[j] || (str1[i] == 'z' && str2[j] == 'a')) { 7 i++, j++; 8 } else 9 i++; 10 } 11 12 return j == size(str2); 13 } 14 };