add: 220302-CN [cpp]

This commit is contained in:
Lam Haoyin 2022-03-02 22:23:50 +08:00
parent 7c317607f4
commit bf1382494e
No known key found for this signature in database
GPG Key ID: 8C089CB1A2B7544F
2 changed files with 18 additions and 1 deletions

17
cpp/2203/220302.cpp Normal file
View File

@ -0,0 +1,17 @@
#include <string>
class Solution {
public:
static bool isSubsequence(const std::string& t, const std::string& s) {
int m = s.length(), n = t.length(), i = 0, j = 0;
while (i < m && j < n) {
if (s[i++] == t[j])
++j;
}
return j == n;
}
};
int main() {
return 0;
}

View File

@ -3,4 +3,4 @@ PROJECT(2203)
SET(CMAKE_CXX_STANDARD 23)
ADD_EXECUTABLE(2203 220302-CN.cpp)
ADD_EXECUTABLE(2203 220302.cpp)