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

1
class Solution {
2
public boolean checkString(String s) {
3
for (int i = 0; i < s.length(); i++) {
4
if (s.charAt(i) == 'b') {
5
for (int j = i + 1; j < s.length(); j++) {
6
if (s.charAt(j) == 'a') {
7
return false;
8
}
9
}
10
}
11
}
12
return true;
13
}
14
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0