Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b343bb9

Browse files
add 2124
1 parent 48017b9 commit b343bb9

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|2124|[Check if All A's Appears Before All B's](https://leetcode.com/problems/check-if-all-as-appears-before-all-bs/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2124.java) ||Easy||
1112
|2120|[Execution of All Suffix Instructions Staying in a Grid](https://leetcode.com/problems/execution-of-all-suffix-instructions-staying-in-a-grid/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2120.java) ||Medium||
1213
|2119|[A Number After a Double Reversal](https://leetcode.com/problems/a-number-after-a-double-reversal/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2119.java) ||Easy||
1314
|2116|[Check if a Parentheses String Can Be Valid](https://leetcode.com/problems/check-if-a-parentheses-string-can-be-valid/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2116.java) ||Medium||
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2124 {
4+
public static class Solution1 {
5+
public boolean checkString(String s) {
6+
int aIndex = s.lastIndexOf('a');
7+
if (aIndex < 0) {
8+
return true;
9+
}
10+
for (int i = 0; i < aIndex; i++) {
11+
if (s.charAt(i) == 'b') {
12+
return false;
13+
}
14+
}
15+
return true;
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)