討論串[閒聊] 每日LeetCode
共 719 篇文章

推噓1(1推 0噓 1→)留言2則,0人參與, 4月前最新作者oin1104 (是oin的說)時間4月前 (2024/02/15 15:05), 編輯資訊
0
0
0
內容預覽:
我也是從最大的開始找. 如果最大的沒辦法弄成合法的多邊型. (最大的邊比其他邊加起來小). 那就把這個邊給排泄掉. 然後找到剩下三個邊都不行的話就是沒有. 那就是回傳-1. class Solution {. public:. long long largestPerimeter(vector<in
(還有380個字)

推噓1(1推 0噓 0→)留言1則,0人參與, 3月前最新作者wu10200512 (廷廷)時間3月前 (2024/02/16 10:38), 編輯資訊
1
0
0
內容預覽:
放進vector後sort. 跟用priority_queue. 誰比較快啊. 1481. Least Number of Unique Integers after K Removals. class Solution {. public:. int findLeastNumOfUniqueInt
(還有332個字)

推噓1(1推 0噓 4→)留言5則,0人參與, 3月前最新作者wu10200512 (廷廷)時間3月前 (2024/02/16 10:57), 編輯資訊
0
0
0
內容預覽:
位元運算不看解答真的解不出來. easy也一樣 我好爛. 191. Number of 1 Bits. class Solution {. public:. int hammingWeight(uint32_t n) {. int count=0;. while(n){. count+=n%2;.
(還有1個字)

推噓3(3推 0噓 0→)留言3則,0人參與, 3月前最新作者wu10200512 (廷廷)時間3月前 (2024/02/16 11:16), 編輯資訊
0
0
0
內容預覽:
我自己寫是每個數字都算一次二進位轉換. 看解答發現可以用類似DP來解. 338. Counting Bits. class Solution {. public:. vector<int> countBits(int n) {. vector<int> ans(n+1, 0);. for(int i
(還有30個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者oin1104 (是oin的說)時間3月前 (2024/02/16 17:58), 編輯資訊
0
0
0
內容預覽:
今天問你刪除k個東西之後. 最少能剩下幾種數字. 所以就. 把數字的種類個數數一數之後. 種類就不重要了. 從最小的那種開始刪. 刪完就完事. ```cpp. class Solution {. public:. int findLeastNumOfUniqueInts(vector<int>& a
(還有891個字)