討論串[閒聊] 每日leetcode
共 1552 篇文章
內容預覽:
2375.. 排數字不能重複. 看要求給他上上下下. 今天的好簡單. 我只會寫這種簡單的. class Solution {. public:. string smallestNumber(string p) {. p = "I" + p;. int n = p.length();. string
(還有239個字)
內容預覽:
https://leetcode.com/problems/letter-tile-possibilities/description. 1079. Letter Tile Possibilities. 給你一個字串tiles,你可以任取至少1個以上的字元,求出共有幾種組合。. 思路:. 普通回溯法
(還有726個字)
內容預覽:
https://leetcode.com/problems/find-the-punishment-number-of-an-integer/description2698. Find the Punishment Number of an Integer. 給你一個數字n,找出1~n之間的懲罰數字
(還有882個字)
內容預覽:
1352. Product of the Last K Numbers. ## 思路. Prefix Product. 用size_紀錄目前Product的個數. 如果add 0 就reset Prefix跟size_. getProduct: prefix[-1] / prefix[size_-k
(還有683個字)
內容預覽:
2342. Max Sum of a Pair With Equal Sum of Digits. ## 思路. 用hash table紀錄digitSum的最大值. table有相同的digitSum就計算兩數和. ## Code. ```cpp. class Solution {. public
(還有551個字)