Tap here to switch tabs
Problem
Submissions

Problem: Apply Operations to Make All Array Elements Zero

Try to solve the Apply Operations to Make All Array Elements Equal to Zero problem.

Statement

You are given a 00 indexed integer array nums and a positive integer k.

In a single operation, you can select any contiguous subarray of length k from nums and decrease each element in that subarray by 11.

Return true if it is possible to make all elements of nums equal to 00 after applying any number of operations, or false otherwise.

Constraints:

  • 1≤1 \leq k ≤\leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Apply Operations to Make All Array Elements Zero

Try to solve the Apply Operations to Make All Array Elements Equal to Zero problem.

Statement

You are given a 00 indexed integer array nums and a positive integer k.

In a single operation, you can select any contiguous subarray of length k from nums and decrease each element in that subarray by 11.

Return true if it is possible to make all elements of nums equal to 00 after applying any number of operations, or false otherwise.

Constraints:

  • 1≤1 \leq k ≤\leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤106\leq 10^6