LeetCode --- 2124. Check if All A‘s Appears Before All B‘s 解题报告

Question:

Given a string s consisting of only the characters 'a' and 'b', return true if every 'a' appears before every 'b' in the string. Otherwise, return false.

Example 1:

Input: s = "aaabbb"
Output: true
Explanation:
The 'a's are at indices 0, 1, and 2, while the 'b's are at indices 3, 4, and 5.
Hence, every 'a' appears before every 'b' and we return true.

Example 2:

Input: s = "abab"
Output: false
Explanation:
There is an 'a' at index 2 and a 'b' at index 1.
Hence, not every 'a' appears before every 'b' 

相关推荐

  1. LeetCode --- 2129. Capitalize the Title 解题报告

    2024-07-12 01:38:01       18 阅读
  2. LeetCode --- 2103. Rings and Rods 解题报告

    2024-07-12 01:38:01       17 阅读
  3. LeetCode --- 2000. Reverse Prefix of Word 解题报告

    2024-07-12 01:38:01       61 阅读
  4. LeetCode --- 2032. Two Out of Three 解题报告

    2024-07-12 01:38:01       44 阅读
  5. LeetCode --- 2057. Smallest Index With Equal Value 解题报告

    2024-07-12 01:38:01       35 阅读
  6. LeetCode --- 2073. Time Needed to Buy Tickets 解题报告

    2024-07-12 01:38:01       22 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-12 01:38:01       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-12 01:38:01       71 阅读
  3. 在Django里面运行非项目文件

    2024-07-12 01:38:01       58 阅读
  4. Python语言-面向对象

    2024-07-12 01:38:01       69 阅读

热门阅读

  1. 【C++编程】程序流程结构

    2024-07-12 01:38:01       19 阅读
  2. 力扣215 数组中第k大的数

    2024-07-12 01:38:01       25 阅读
  3. arcgis js 4.x实现类似openalayers加载tilewms图层效果

    2024-07-12 01:38:01       22 阅读
  4. 【Go - 常见的5类函数用法】

    2024-07-12 01:38:01       21 阅读
  5. kotlin flow collect collectLatest 区别

    2024-07-12 01:38:01       24 阅读
  6. 搜维尔科技:触觉反馈数据手套CyberGlove击鼓测试

    2024-07-12 01:38:01       19 阅读