Tap here to switch tabs
Problem
Submissions

Problem: Count Partitions With Max-Min Difference at Most K

Count Partitions With Max-Min Difference at Most K asks you to split an integer array into nonempty contiguous subarrays and count partitions where each subarray's maximum-minus-minimum is at most k.

Statement

Given an integer array nums and an integer k, determine the total number of partitions of nums into contiguous non empty subarrays such that for every subarray, the difference between its maximum element and its minimum element is at most k.

Constraints:

  • 2≤2 \leq nums.length ≤5×104\leq 5 \times 10^4

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 0≤0 \leq k ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Partitions With Max-Min Difference at Most K

Count Partitions With Max-Min Difference at Most K asks you to split an integer array into nonempty contiguous subarrays and count partitions where each subarray's maximum-minus-minimum is at most k.

Statement

Given an integer array nums and an integer k, determine the total number of partitions of nums into contiguous non empty subarrays such that for every subarray, the difference between its maximum element and its minimum element is at most k.

Constraints:

  • 2≤2 \leq nums.length ≤5×104\leq 5 \times 10^4

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 0≤0 \leq k ≤109\leq 10^9