討論串[閒聊] 每日leetcode
共 1548 篇文章
內容預覽:
713. Subarray Product Less Than K. 用two pointer. 持續記錄目前的product. 若product有超過就移動左邊. 否則就持續移動右邊. int numSubarrayProductLessThanK(vector<int>& nums, int k
(還有211個字)
內容預覽:
https://leetcode.com/problems/subarray-product-less-than-k. 713. Subarray Product Less Than K. 給你一個陣列 nums,找出他的子陣列有幾個內積小於k。. 思路:. 1.滿足特定條件的子陣列問題基本上都是滑
(還有555個字)
內容預覽:
我好想轉職,有沒有人可以內推我去寫韌體. 41. First Missing Positive. 有一個array nums,請問第一個沒有在nums裡面的正整數是多少?. 請用o(n)時間複雜度、o(1)空間複雜度. 思路 :. 負數不重要. 第一個沒出現的正整數如果是x,那代表1~x-1都有在n
(還有843個字)
內容預覽:
幹你老師,打到一半閃退,全部都不見了. 287. Find the Duplicate Number. 有一個矩陣nums,長度為n+1,矩陣元素大小介於[1,n]. 矩陣內有一個數字會重複出現,請問該數字是多少?. 題目限制:不能修改原本的矩陣、只能使用constant extra space.
(還有550個字)
內容預覽:
https://leetcode.com/problems/find-all-duplicates-in-an-array. 442. Find All Duplicates in an Array. 給你一個大小為 n 的陣列,裡面只包含1~n,每個元素只會出現一次或兩次,求出哪些. 數字出現超過
(還有584個字)