Tap here to switch tabs
Problem
Submissions

Problem: Kth Smallest Subarray Sum

med
30 min
Try to solve the Kth Smallest Subarray Sum problem.

Statement

Given an integer array nums of length n and an integer k, return the kextthk^{ ext{th}} smallest subarray sum among all possible contiguous subarrays of nums.

A subarray is defined as a contiguous sequence of elements within an array. The sum of a subarray is the sum of all its elements.

Constraints:

  • n == nums.length

  • 1≤1 \leq n ≤2⋅104\leq 2 \cdot 10^4

  • 1≤1 \leq nums[i] ≤5⋅104\leq 5 \cdot 10^4

  • 1≤1 \leq k ≤\leq n ⋅(\cdot ( n +1)/2+ 1) / 2

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Kth Smallest Subarray Sum

med
30 min
Try to solve the Kth Smallest Subarray Sum problem.

Statement

Given an integer array nums of length n and an integer k, return the kextthk^{ ext{th}} smallest subarray sum among all possible contiguous subarrays of nums.

A subarray is defined as a contiguous sequence of elements within an array. The sum of a subarray is the sum of all its elements.

Constraints:

  • n == nums.length

  • 1≤1 \leq n ≤2⋅104\leq 2 \cdot 10^4

  • 1≤1 \leq nums[i] ≤5⋅104\leq 5 \cdot 10^4

  • 1≤1 \leq k ≤\leq n ⋅(\cdot ( n +1)/2+ 1) / 2