← back

Prefix Sum

214 questions · 0 seen

All Prefix Sum problems

Problems

209 Minimum Size Subarray Sum
238 Product of Array Except Self
303 Range Sum Query - Immutable
304 Range Sum Query 2D - Immutable
363 Max Sum of Rectangle No Larger Than K
410 Split Array Largest Sum
497 Random Point in Non-overlapping Rectangles
523 Continuous Subarray Sum
525 Contiguous Array
528 Random Pick with Weight
560 Subarray Sum Equals K
689 Maximum Sum of 3 Non-Overlapping Subarrays
713 Subarray Product Less Than K
724 Find Pivot Index
731 My Calendar II
732 My Calendar III
798 Smallest Rotation with Highest Score
813 Largest Sum of Averages
848 Shifting Letters
862 Shortest Subarray with Sum at Least K
903 Valid Permutations for DI Sequence
930 Binary Subarrays With Sum
974 Subarray Sums Divisible by K
995 Minimum Number of K Consecutive Bit Flips
1000 Minimum Cost to Merge Stones
1004 Max Consecutive Ones III
1074 Number of Submatrices That Sum to Target
1094 Car Pooling
1109 Corporate Flight Bookings
1124 Longest Well-Performing Interval
1140 Stone Game II
1177 Can Make Palindrome from Substring
1208 Get Equal Substrings Within Budget
1248 Count Number of Nice Subarrays
1292 Maximum Side Length of a Square with Sum Less than or Equal to Threshold
1310 XOR Queries of a Subarray
1314 Matrix Block Sum
1352 Product of the Last K Numbers
1371 Find the Longest Substring Containing Vowels in Even Counts
1413 Minimum Value to Get Positive Step by Step Sum
1420 Build Array Where You Can Find The Maximum Exactly K Comparisons
1422 Maximum Score After Splitting a String
1423 Maximum Points You Can Obtain from Cards
1442 Count Triplets That Can Form Two Arrays of Equal XOR
1444 Number of Ways of Cutting a Pizza
1480 Running Sum of 1d Array
1508 Range Sum of Sorted Subarray Sums
1524 Number of Sub-arrays With Odd Sum
1546 Maximum Number of Non-Overlapping Subarrays With Sum Equals Target
1588 Sum of All Odd Length Subarrays
1589 Maximum Sum Obtained of Any Permutation
1590 Make Sum Divisible by P (PRO)
1621 Number of Sets of K Non-Overlapping Line Segments
1658 Minimum Operations to Reduce X to Zero
1664 Ways to Make a Fair Array
1674 Minimum Moves to Make Array Complementary
1685 Sum of Absolute Differences in a Sorted Array
1687 Delivering Boxes from Storage to Ports
1703 Minimum Adjacent Swaps for K Consecutive Ones
1712 Ways to Split Array Into Three Subarrays
1732 Find the Highest Altitude
1737 Change Minimum Characters to Satisfy One of Three Conditions
1738 Find Kth Largest XOR Coordinate Value (PRO)
1744 Can You Eat Your Favorite Candy on Your Favorite Day?
1769 Minimum Number of Operations to Move All Balls to Each Box
1829 Maximum XOR for Each Query
1838 Frequency of the Most Frequent Element
1854 Maximum Population Year (PRO)
1856 Maximum Subarray Min-Product
1862 Sum of Floored Pairs
1871 Jump Game VII
1872 Stone Game VIII
1878 Get Biggest Three Rhombus Sums in a Grid
1889 Minimum Space Wasted From Packaging
1893 Check if All the Integers in a Range Are Covered
1894 Find the Student that Will Replace the Chalk
1895 Largest Magic Square (PRO)
1906 Minimum Absolute Difference Queries (PRO)
1915 Number of Wonderful Substrings
1930 Unique Length-3 Palindromic Subsequences (PRO)
1943 Describe the Painting
1959 Minimum Total Space Wasted With K Resizing Operations
1991 Find the Middle Index in Array (PRO)
2017 Grid Game
2024 Maximize the Confusion of an Exam
2025 Maximum Number of Ways to Partition an Array
2055 Plates Between Candles
2100 Find Good Days to Rob the Bank
2106 Maximum Fruits Harvested After at Most K Steps
2121 Intervals Between Identical Elements
2132 Stamping the Grid
2145 Count the Hidden Sequences
2171 Removing Minimum Number of Magic Beans
2207 Maximize Number of Subsequences in a String
2209 Minimum White Tiles After Covering With Carpets
2218 Maximum Value of K Coins From Piles
2222 Number of Ways to Select Buildings
2234 Maximum Total Beauty of the Gardens
2245 Maximum Trailing Zeros in a Cornered Path
2251 Number of Flowers in Full Bloom
2256 Minimum Average Difference
2270 Number of Ways to Split Array
2271 Maximum White Tiles Covered by a Carpet
2281 Sum of Total Strength of Wizards
2302 Count Subarrays With Score Less Than K
2381 Shifting Letters II
2382 Maximum Segment Sum After Removals
2389 Longest Subsequence With Limited Sum
2391 Minimum Amount of Time to Collect Garbage
2398 Maximum Number of Robots Within Budget
2406 Divide Intervals Into Minimum Number of Groups
2420 Find All Good Indices
2428 Maximum Sum of an Hourglass
2438 Range Product Queries of Powers
2439 Minimize Maximum of Array
2448 Minimum Cost to Make Array Equal
2478 Number of Beautiful Partitions
2483 Minimum Penalty for a Shop
2485 Find the Pivot Integer
2488 Count Subarrays With Median K
2528 Maximize the Minimum Powered City
2536 Increment Submatrices by One
2552 Count Increasing Quadruplets
2559 Count Vowel Strings in Ranges
2574 Left and Right Sum Differences
2587 Rearrange Array to Maximize Prefix Score
2588 Count the Number of Beautiful Subarrays
2602 Minimum Operations to Make All Array Elements Equal
2615 Sum of Distances
2640 Find the Score of All Prefixes of an Array
2680 Maximum OR
2681 Power of Heroes
2731 Movement of Robots
2772 Apply Operations to Make All Array Elements Equal to Zero
2845 Count of Interesting Subarrays
2848 Points That Intersect With Cars
2875 Minimum Size Subarray in Infinite Array
2906 Construct Product Matrix
2947 Count Beautiful Substrings I
2949 Count Beautiful Substrings II
2968 Apply Operations to Maximize Frequency Score
2971 Find Polygon With the Largest Perimeter
2983 Palindrome Rearrangement Queries
3015 Count the Number of Houses at a Certain Distance I
3017 Count the Number of Houses at a Certain Distance II
3026 Maximum Good Subarray Sum
3028 Ant on the Boundary
3070 Count Submatrices with Top-Left Element and Sum Less Than k
3077 Maximum Strength of K Disjoint Subarrays
3086 Minimum Moves to Pick K Ones (PRO)
3096 Minimum Levels to Gain More Points
3129 Find All Possible Stable Binary Arrays I
3130 Find All Possible Stable Binary Arrays II
3147 Taking Maximum Energy From the Mystic Dungeon
3152 Special Array II
3179 Find the N-th Value After K Seconds
3191 Minimum Operations to Make Binary Array Elements Equal to One I
3212 Count Submatrices With Equal Frequency of X and Y
3224 Minimum Array Changes to Make Differences Equal
3225 Maximum Score From Grid Operations
3250 Find the Count of Monotonic Pairs I
3251 Find the Count of Monotonic Pairs II
3261 Count Substrings That Satisfy K-Constraint II
3312 Sorted GCD Pair Queries (PRO)
3333 Find the Original Typed String II
3346 Maximum Frequency of an Element After Performing Operations I
3347 Maximum Frequency of an Element After Performing Operations II
3354 Make Array Elements Equal to Zero
3355 Zero Array Transformation I
3356 Zero Array Transformation II
3361 Shift Distance Between Two Strings
3362 Zero Array Transformation III
3364 Minimum Positive Sum Subarray
3381 Maximum Subarray Sum With Length Divisible by K
3413 Maximum Coins From K Consecutive Bags
3425 Longest Special Path
3427 Sum of Variable Length Subarrays
3432 Count Partitions with Even Sum Difference
3434 Maximum Frequency After Subarray Operation
3445 Maximum Difference Between Even and Odd Frequency II
3473 Sum of K Subarrays With Length at Least M
3480 Maximize Subarrays After Removing One Conflicting Pair
3486 Longest Special Path II
3494 Find the Minimum Amount of Time to Brew Potions
3500 Minimum Cost to Divide Array Into Subarrays
3538 Merge Operations for Minimum Travel Time
3546 Equal Sum Grid Partition I
3548 Equal Sum Grid Partition II
3578 Count Partitions With Max-Min Difference at Most K
3599 Partition Array to Minimize XOR
3628 Maximum Number of Subsequences After One Inserting
3636 Threshold Majority Queries
3652 Best Time to Buy and Sell Stock using Strategy
3654 Minimum Sum After Divisible Sum Deletions
3694 Distinct Points Reachable After Substring Removal
3698 Split Array With Minimum Difference
3699 Number of ZigZag Arrays I
3707 Equal Score Substrings
3709 Design Exam Scores Tracker
3714 Longest Balanced Substring II
3719 Longest Balanced Subarray I
3721 Longest Balanced Subarray II
3728 Stable Subarrays With Equal Boundary and Interior Sum
3729 Count Distinct Subarrays Divisible by K in Sorted Array
3737 Count Subarrays With Majority Element I
3739 Count Subarrays With Majority Element II
3748 Count Stable Subarrays
3755 Find Maximum Balanced XOR Subarray Length
3756 Concatenate Non-Zero Digits and Multiply by Sum II
3771 Total Score of Dungeon Runs
3788 Maximum Score of a Split
3797 Count Routes to Climb a Rectangular Grid
3826 Minimum Partition Score
3845 Maximum Subarray XOR with Bounded Range