leetcode
含有「leetcode」共 457 篇內容
全部內容
發佈日期由新至舊
Leetcode 練習 🔥
2025/08/29
3021. Alice and Bob Playing Flower Game
[Medium] 解法 : Math 題意 : 有兩列,第一列會有 x 朵花,第二列則有 y 朵。有兩個人,Alice 和 Bob,Alice 會先挑選其中一朵花丟掉,再來換 Bob 挑選花丟掉,如果丟掉花後,兩列都沒有花了,則最後挑選花的人獲勝。 給定 n 與 m,去看共有幾種 (x, y
#
leetcode
#
偶數
1
留言
Leetcode 練習 🔥
2025/08/19
837. New 21 Game
[Medium] 解法 : DP + sliding window 題意 : 給定 n、k、maxPts 起始分數為 0。 分數小於 k 時,會隨機抽一個介於 1 到 maxPts 的整數點數,每次抽牌機率相同且獨立。 當分數達到或超過 k 時停止抽牌。 回傳最終分數 不超過 n 的機率
#
leetcode
#
分數
#
機率
1
留言
周濡墨的沙龍
2025/08/19
LeetCode -- 2. Add Two Numbers
Description You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of thei
#
資訊
#
電腦
#
computerscience
2
留言
周濡墨的沙龍
2025/08/15
LeetCode -- 808. Soup Servings
Soup Servings - LeetCode Description You have two soups, A and B, each starting with n mL. On every turn, one of the following four serving operatio
5/5
LeetCode
#
電腦
#
資訊
#
computerscience
1
留言
周濡墨的沙龍
2025/08/06
Leetcode -- 904. Fruit Into Baskets
將水果放入籃子 - LeetCode --- Fruit Into Baskets - LeetCode Description You are visiting a farm that has a single row of fruit trees arranged from......
#
leetcode
#
資訊
#
computerscience
1
留言
周濡墨的沙龍
2025/08/01
Leetcode - pascal's triangle
Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly.....
5/5
leetcode
#
leetcode
#
資訊
#
computerscience
2
留言
Leetcode 練習 🔥
2025/07/30
3629. Minimum Jumps to Reach End via Prime Teleportation
[Medium] 解法 : BFS 題意 : 給定一個長度為 n 的整數陣列 nums,從索引 0 開始,目標是走到索引 n - 1。 對於任意索引 i,可進行以下操作: 相鄰跳躍:索引仍在陣列範圍內,可以跳到 i + 1 或 i - 1。 質數傳送:如果 nums[i] 是一個質數
#
leetcode
#
執行
1
留言
周濡墨的沙龍
2025/07/30
Leetcode -- Two-sum
information link:Two Sum - LeetCode Description:Given an array of integers nums and an integer target, return indices of the two numbers such......
5/5
leetcode
#
leetcode
#
computerscience
#
電腦
2
留言
Leetcode 練習 🔥
2025/07/19
3619. Count Islands With Total Value Divisible by K
[Medium] 解法 : BFS 題意 : 給定一個二維陣列,元素為整數,與一個整數 k。其中被 0 圍起來的整數區塊為 island,island value 為區塊內元素數值的總和。一個合法的小島是其 value 可以被 k 整除,求出符合此條件的所有小島,並將 value 加總回傳。
#
leetcode
#
條件
1
留言
Leetcode 練習 🔥
2025/07/15
3136. Valid Word
[Easy] 解法 : Traversal 題意 : 給定一個字串,判斷其是否合法。合法的條件如下,全部皆需要滿足 最少需要 3 個字元 字串中只能含有英文字母與數字 字串中至少要有一個母音 (vowel) 字串中至少要有一個子音 (consonant) 解題思路 : 用一個 s
#
leetcode
2
留言