Prefix Sum
Prefix Sum
Twenty questions on prefix sums, for answering range-sum and cumulative queries without recomputing from scratch.
Ant on the Boundary
easyAn ant is on a boundary.
Check if All the Integers in a Range Are Covered
easyYou are given a 2D integer array ranges and two integers left and right.
Count Partitions with Even Sum Difference
easyYou are given an integer array nums of length n.
Find Pivot Index
easyGiven an array of integers nums, calculate the pivot index of this array.
Find the Highest Altitude
easyThere is a biker going on a road trip.
Find the Middle Index in Array
easyGiven a 0-indexed integer array nums, find the leftmost middleIndex (i.e., the smallest amongst all the possible ones).
Find the Pivot Integer
easyGiven a positive integer n, find the pivot integer x such that: Return the pivot integer x.
Left and Right Sum Differences
easyYou are given a 0-indexed integer array nums of size n.
Longest Subsequence With Limited Sum
easyYou are given an integer array nums of length n, and an integer array queries of length m.
Make Array Elements Equal to Zero
easyYou are given an integer array nums.
Maximum Population Year
easyYou are given a 2D integer array logs where each logs[i] = [birthi, deathi] indicates the birth and death years of the ith person.
Maximum Score After Splitting a String
easyGiven a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (i.e.
Minimum Positive Sum Subarray
easyYou are given an integer array nums and two integers l and r.
Minimum Value to Get Positive Step by Step Sum
easyGiven an array of integers nums, you start with an initial positive value startValue.
Points That Intersect With Cars
easyYou are given a 0-indexed 2D integer array nums representing the coordinates of the cars parking on a number line.
Running Sum of 1d Array
easyGiven an array nums.
Sum of All Odd Length Subarrays
easyGiven an array of positive integers arr, return the sum of all possible odd-length subarrays of arr.
Sum of Variable Length Subarrays
easyYou are given an integer array nums of size n.
Apply Operations to Make All Array Elements Equal to Zero
mediumYou are given a 0-indexed integer array nums and a positive integer k.
Binary Subarrays With Sum
mediumGiven a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal.