2124. Check if All A's Appears Before All B's ¶ Time: $O(n)$ Space: $O(n)$ C++JavaPython 1 2 3 4 5 6class Solution { public: bool checkString(string s) { return s.find("ba") == string::npos; } }; 1 2 3 4 5class Solution { public boolean checkString(String s) { return !s.contains("ba"); } } 1 2 3class Solution: def checkString(self, s: str) -> bool: return 'ba' not in s