2124. Check if All A's Appears Before All B's
Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 72% Topics: String
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(n)
# Space: O(1)
class Solution(object):
def checkString(self, s):
"""
:type s: str
:rtype: bool
"""
return "ba" not in s
Solution from kamyu104/LeetCode-Solutions · MIT