LeetCodeCheck if All A's Appears Before All B'sCheck if All A's Appears Before All B'sEasyStringSolution export function checkString(s: string): boolean { const lastAIndex = s.lastIndexOf('a'); const firstBIndex = s.indexOf('b'); if (lastAIndex === -1 || firstBIndex === -1) { return true; } return lastAIndex < firstBIndex; }LeetCodeCheck if All A's Appears Before All B'shttps://leetcode.com/problems/check-if-all-as-appears-before-all-bs