Check if All A's Appears Before All B's LeetCode solution in C++

1
class Solution {
2
public:
3
bool checkString(string s) {
4
for (int i = 1; i < s.size(); i++) {
5
if (s[i - 1] == 'b' && s[i] == 'a') {
6
return false;
7
}
8
}
9
return true;
10
}
11
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0