討論串[閒聊] 每日leetcode
共 1554 篇文章

推噓0(0推 0噓 1→)留言1則,0人參與, 1年前最新作者dont (dont)時間1年前 (2024/11/15 23:24), 編輯資訊
0
0
0
內容預覽:
1574. Shortest Subarray to be Removed to Make Array Sorted. ## 思路. 刪subarray有三種Case:. 1. 去頭 -- arr[right:] 遞增. 2. 去尾 -- arr[:left] 遞增. 3. 刪中間 -- arr[:
(還有648個字)

推噓-1(0推 1噓 1→)留言2則,0人參與, 1年前最新作者oin1104 (是oin的說)時間1年前 (2024/11/14 23:07), 編輯資訊
0
0
0
內容預覽:
題目:. 要把一堆東西分到n個籃子裏面. 一個籃子只能分到一個index的值. 最小的 裡面之中最大的元素. 是多少. 思路:. 我用pq. 每次都把最大的東西分散. 分散n次就可以確保一定是最好的情況. 有點暴力. 姆咪. ```cpp. class Solution {. public:. in
(還有560個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者DJYOMIYAHINA (通通打死)時間1年前 (2024/11/14 22:49), 1年前編輯資訊
0
0
0
內容預覽:
小看一下hint. 又是binary search. 我對binary search的聯想力真的很不構= =. def minimizedMaximum(self, n: int, quantities: List[int]) -> int:. def canbeDistributed(k):. c
(還有227個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者JIWP (神楽めあ的錢包)時間1年前 (2024/11/14 22:35), 編輯資訊
0
0
0
內容預覽:
2064. Minimized Maximum of Products Distributed to Any Store. 有n個零售商. m種不同的商品. quantities矩陣表示每種商品的數量. 必須把所有商品分配給零售商. 而且每一個零售商只能拿一種商品. 在分配完所有商品後. 假設x是單
(還有850個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者dont (dont)時間1年前 (2024/11/14 21:54), 編輯資訊
0
0
0
內容預覽:
2064. Minimized Maximum of Products Distributed to Any Store. ## 思路. 對答案範圍做Binary Search. ## Code. ```python. class Solution:. def minimizedMaximum(se
(還有446個字)