cs: add «2825. Make String a Subsequence Using Cyclic Increments»

URL:	https://leetcode.com/problems/make-string-a-subsequence-using-cyclic-increments/
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-12-04 13:41:16 +01:00
parent decfe0c0b3
commit e5ef5167a7
No account linked to committer's email address

View file

@ -0,0 +1,12 @@
public class Solution {
public bool CanMakeSubsequence(string str1, string str2) {
int j = 0;
for (int i = 0; i < str1.Length && j < str2.Length; ++i) {
if (str1[i] == str2[j] || str1[i] + 1 == str2[j] || str1[i] - 25 == str2[j]) {
++j;
}
}
return j == str2.Length;
}
}