Tagged in

String

數據共筆
數據共筆
Followers
5
Elsewhere
More, on Medium

Leetcode:(String)(Python)Count Binary Substrings

題目連結:https://leetcode.com/problems/count-binary-substrings/description/

題目會給出一個只有0和1的字串,要找出能夠組成幾個數量一致的子組合,譬如01, 0011, 10, 1100等


Reverse Vowels of a String

題目連結:https://leetcode.com/problems/reverse-vowels-of-a-string/

把字串中的母音交換位置

和 Reverse String是相似題目,相關的說明我已經寫在 LeetCode:(String)(Python)Reverse String

初始想法

  1. 不能用 s = s[::-1],所以我採用迴圈

LeetCode:(String)(Python)Reverse String

題目連結:https://leetcode.com/problems/reverse-string/

把一個 list整個反過來,不用 return,而是把存在原本的 list中。

題目限制只能使用 O(1)記憶體。

初始想法