[#3227] feat(leetcode): add c# and golang solution
This commit is contained in:
82
problems/3227-vowels-game-in-a-string/README.md
Normal file
82
problems/3227-vowels-game-in-a-string/README.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# [3227] Vowels Game In A String
|
||||
|
||||
## 題目資訊
|
||||
- **難度**: Medium
|
||||
- **標籤**: Math, String, Brainteaser, Game Theory
|
||||
- **題目連結**: https://leetcode.com/problems/vowels-game-in-a-string/
|
||||
- **練習日期**: 2025-09-12
|
||||
- **目標複雜度**: 時間 O(n)、空間 O(1)
|
||||
|
||||
## 題目描述
|
||||
Alice and Bob are playing a game on a string.
|
||||
|
||||
You are given a string `s`, Alice and Bob will take turns playing the following game where Alice starts **first**:
|
||||
|
||||
On Alice's turn, she has to remove any **non-empty** substring from `s` that contains an odd number of vowels.
|
||||
On Bob's turn, he has to remove any non-empty substring from `s` that contains an even number of vowels.
|
||||
The first player who cannot make a move on their turn loses the game. We assume that both Alice and Bob play optimally.
|
||||
|
||||
Return `true` if Alice wins the game, and `false` otherwise.
|
||||
|
||||
The English vowels are: `a`, `e`, `i`, `o`, and `u`.
|
||||
|
||||
## 先備條件與限制
|
||||
- 輸入限制:n ∈ [?, ?]、值域 ∈ [?, ?]
|
||||
- 回傳/輸出格式:...
|
||||
- 其他:是否允許排序/就地修改
|
||||
|
||||
## 解題思路
|
||||
|
||||
### 初步分析
|
||||
- 類型:雙指針 / 滑動視窗 / 排序 / DP / 貪心 / 圖論 ...
|
||||
- 關鍵觀察:
|
||||
- 複雜度目標理由:
|
||||
|
||||
### 解法比較
|
||||
1. 解法A(基準/暴力):
|
||||
- 思路:
|
||||
- 正確性:
|
||||
- 複雜度:O(?) / O(?)
|
||||
2. 解法B(優化):
|
||||
- 思路:
|
||||
- 正確性:
|
||||
- 複雜度:O(?) / O(?)
|
||||
|
||||
### 乾跑(Dry Run)
|
||||
- 範例:...
|
||||
|
||||
### 常見陷阱
|
||||
- 邊界:空/單一/極值/全相等
|
||||
- 去重:排序後跳重複、集合
|
||||
- 溢位:使用 64-bit
|
||||
|
||||
## 測試案例
|
||||
|
||||
### 範例輸入輸出
|
||||
```
|
||||
Input: ...
|
||||
Output: ...
|
||||
Explanation: ...
|
||||
```
|
||||
|
||||
### 邊界清單
|
||||
- [ ] 空陣列/空字串
|
||||
- [ ] 單一元素 / 全相同
|
||||
- [ ] 含負數/0/大數
|
||||
- [ ] 去重
|
||||
- [ ] 大資料壓力
|
||||
|
||||
## 複雜度分析
|
||||
- 最壞:時間 O(?)、空間 O(?)
|
||||
|
||||
## 相關題目 / Follow-up
|
||||
-
|
||||
|
||||
## 學習筆記
|
||||
- 今天學到:
|
||||
- 卡住與修正:
|
||||
- 待優化:
|
||||
|
||||
---
|
||||
**總結**:這題的核心在於 ______,適合練習 ______。
|
||||
|
Reference in New Issue
Block a user