2243. Check if All A's Appears Before All B's
My accepted C++ solution to LeetCode problem 2243, Check if All A's Appears Before All B's, running in 0ms.
- Difficulty: Easy
- C++
- Runtime 0ms
- Memory 8.2MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
C++
Accepted on LeetCode — runtime 0ms, memory 8.2MB, accepted 2025-12-27.
class Solution {
public:
bool checkString(string s) {
return s.find("ba") == string::npos;
}
};