討論串[閒聊] 每日leetcode
共 1548 篇文章
內容預覽:
2962. Count Subarrays Where Max Element Appears at Least K Times. 廢廢如我. 只想到慢慢用map記index. 都比那些sliding的慢 一生就這樣了. long long countSubarrays(vector<int>& n
(還有375個字)
內容預覽:
2962. Count Subarrays Where Max Element Appears at Least K Times. Solved. Medium. Topics. Companies. You are given an integer array nums and a positiv
(還有1262個字)
內容預覽:
373. Find K Pairs with Smallest Sums. 有兩個array nums1、nums2以遞增的順序排序. 定義分別從nums1、nums2各取一個元素所組成的組合[nums1[i]、nums2[j]]. 請回傳前k總和最小的組合. 思路:. 因為nums1、nums2是
(還有1646個字)
內容預覽:
2958. Length of Longest Subarray With at Most K Frequency. 用window,同時記錄window內的cnt並更新. 當cnt>k時,滑動左邊讓window內的cnt再次符合條件. 寫起來跟昨天87%像. int maxSubarrayLeng
(還有430個字)
內容預覽:
https://leetcode.com/problems/length-of-longest-subarray-with-at-most-k-frequency2958. Length of Longest Subarray With at Most K Frequency. 給你一個陣列 num
(還有634個字)