lee215在leetcode論壇上,有關題目的post。
Problems | 心得 |
---|---|
2281. Sum of Total Strength of Wizards | |
1074. Number of Submatrices That Sum to Target | 怎麼利用prefix sum把 |
974. Subarray Sums Divisible by K | 怎麼處理prefix sum 為負的情況?解法 |
unordered_map<int, int> m{{0, 1}};
Problems | 心得 |
---|---|
2958. Length of Longest Subarray With at Most K Frequency | 使用unordered_map<int, int>來統計數字出現的次數 |
2831. Find the Longest Equal Subarray | |
2799. Count Complete Subarrays in an Array | 滿足條件後,計算subarray的方法 ans += nums.size() - right; |
2779. Maximum Beauty of an Array After Applying Operation | |
930. Binary Subarrays With Sum | 可以用prefix sum來解 使用slinding window就必須要用 atMost(goal) - atMost(goal - 1) |
992. Subarrays with K Different Integers | |
904. Fruit Into Baskets | |
862. Shortest Subarray with Sum at Least K | |
424. Longest Repeating Character Replacement | |
209. Minimum Size Subarray Sum | 使用slinding window來追蹤sum的大小 |
Problems | 心得 |
---|---|
2735. Collecting Chocolates | |
2594. Minimum Time to Repair Cars | |
2454. Next Greater Element IV | |
901. Online Stock Span | |
856. Score of Parentheses | |
503. Next Greater Element II | 把array循環兩次 |
Problems | 心得 |
---|---|
2866. Beautiful Towers II | |
2454. Next Greater Element IV | |
2398. Maximum Number of Robots Within Budget |