Container With Most Water
這題的目標是從給定的非負整數陣列height中,找到兩條垂直線,使它們與x軸圍成的容器能裝最多的水。容...
今天是第十三天,今天解 a038. 數字翻轉。題目要求將輸入的值全部翻轉(ex: 54321 -> 12345),本題使用條件判斷式之一的while迴圈就...
Generate Parentheses
這是一道基於遞迴實現回溯的問題,要求生成所有有效的括號組合(well-formed Parentheses)。...
Move Zeroes (LeetCode 283, Two Pointers)
解題思路
使用 快慢指針:
slow:下一個非零要放的位置
fast:遍歷...