Posts with tag 'prefix sum'

Maximum Sum Rectangle with Condition

less than 1 minute read

Given a two-dimensional integer matrix matrix and an integer k, return the largest sum of a rectangle ≤ k.

Maximum Sum Removing K Numbers From Ends

1 minute read

You are given a list of integers nums and integer k. Return the maximum sum of elements that you can remove given that you must pop exactly k times, where ea...

Longest Zero Sublist Sum

less than 1 minute read

Given a list of integers nums, which contains either -1 or 1, return the length of the longest sublist that sums to 0.

Stacks

1 minute read

Given a list of list of positive integers stacks, you can take any stack(s) in stacks and pop any number of elements. Return the maximum sum that can be achi...

Max Sum of Two Non-Overlapping Lists

less than 1 minute read

Given a list of integers nums and integers a and b, return the max sum of two non-overlapping sublists in nums which have lengths a and b.

Largest Sum of 3 Non-Overlapping Sublists

less than 1 minute read

Given a list of integers nums and an integer k, return the largest sum of three non-overlapping sublists of nums each of size k.

Largest Sublist Sum

less than 1 minute read

Given a list of integers nums, return the sum of a non-empty contiguous sublist with the largest sum.

Uber Pool

1 minute read

You are given a two-dimensional integer list requested_trips containing [start_x, end_x, num_passengers], and an integer capacity. Each requested trip asks t...

Range Update

1 minute read

You are given a list of integers nums and a two-dimensional list of integers operations. Each operation is of the following form: [L, R, X], which means that...

Number of Sublists With Sum of Target

less than 1 minute read

Given a list of integers nums and an integer target, return the number of sublists whose sum is equal to target.

Minimum Initial Value for Positive Prefix Sums

less than 1 minute read

You are given a list of integers nums. Return the minimum positive value we can append to the beginning of nums such that prefix sums of the resulting list c...

K Prefix

1 minute read

Given a list of integers nums and an integer k, return the maximum possible i where nums[0] + nums[1] + ... + nums[i] ≤ k. Return -1 if no valid i exists.

Index with Equal Left and Right Sums

1 minute read

Given a list of integer nums, return the earliest index i such that the sum of the numbers left of i is equal to the sum of numbers right of i. If there’s no...

Balanced Brackets

less than 1 minute read

You’re given a string s consisting solely of "(" and ")". Return whether the parentheses are balanced.

Back to top ↑