LeetCode 974: Subarray Sums Divisible by K
A clear explanation of counting subarrays whose sum is divisible by k using prefix sums and remainder frequencies.
30 notes
A clear explanation of counting subarrays whose sum is divisible by k using prefix sums and remainder frequencies.
A clear explanation of the Shifting Letters problem using suffix sums and modulo arithmetic.
A clear explanation of the Consecutive Numbers Sum problem using arithmetic series formulas and divisibility analysis.
A clear explanation of counting valid DI permutations using dynamic programming and prefix sums.
A clear explanation of merging consecutive stone piles with minimum cost using interval dynamic programming.
A clear explanation of finding the shortest non-empty subarray with sum at least k using prefix sums and a monotonic deque.
A clear explanation of solving Binary Subarrays With Sum using prefix sums and a frequency map.
A counting solution for computing how many directed friend requests are allowed by age rules.
A dynamic programming and prefix sum solution for partitioning an array into adjacent groups with maximum total average.
A clear explanation of finding the smallest rotation with maximum score using a difference array.
A clear explanation of finding the leftmost pivot index using prefix sums and a running left sum.
A binary search solution for finding the maximum average of any contiguous subarray with length at least k.
A dynamic programming solution for counting permutations of 1 to n with exactly k inverse pairs.
A clear explanation of Subarray Sum Equals K using prefix sums and a hash map to count matching subarrays in linear time.
A clear explanation of Brick Wall using prefix sums and a hash map to find the best vertical cut position.
A clear explanation of splitting an array into four equal-sum parts using prefix sums and set-based search.
A clear explanation of weighted random sampling using prefix sums and binary search.
A clear explanation of finding the longest contiguous subarray with equal numbers of 0 and 1 using prefix sums and a hash map.
A clear explanation of detecting a subarray whose sum is a multiple of k using prefix sums and modular arithmetic.
A clear explanation of balancing dresses across washing machines using greedy prefix flow.
A clear explanation of Find Median Given Frequency of Numbers using cumulative frequency and SQL window functions.
A clear explanation of uniformly picking an integer point from non-overlapping rectangles using prefix sums and binary search.
Count downward paths in a binary tree whose values sum to targetSum using DFS and prefix sums.
A clear explanation of applying many range updates efficiently using a difference array and prefix sums.
A clear explanation of reducing a 2D rectangle problem to a 1D prefix-sum problem with binary search.
A clear explanation of Count of Range Sum using prefix sums and merge sort counting.
A clear explanation of Maximum Size Subarray Sum Equals k using prefix sums and earliest-index hashing.
A clear explanation of Range Sum Query 2D - Immutable using a 2D prefix sum matrix for constant-time rectangle queries.
A clear explanation of Range Sum Query - Immutable using prefix sums for constant-time range queries.
Precompute cumulative sums to answer range sum queries in constant time.