Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make the Array K-Increasing

med
30 min
Try to solve the Minimum Operations to Make the Array K-Increasing problem.

Statement

You are given a 00 indexed integer array arr consisting of positive integers, and a positive integer k.

The array arr is defined as kk increasing if arr[i - k] ≤\leq arr[i] holds for all indices i such that k≤k \leq i << arr.length.

In a single operation, you can choose any index i and replace arr[i] with any positive integer.

Return the minimum number of operations required to make arr kk increasing.

Constraints:

  • 1≤1 \leq arr.length ≤105\leq 10^5

  • 1≤1 \leq arr[i], k ≤\leq arr.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make the Array K-Increasing

med
30 min
Try to solve the Minimum Operations to Make the Array K-Increasing problem.

Statement

You are given a 00 indexed integer array arr consisting of positive integers, and a positive integer k.

The array arr is defined as kk increasing if arr[i - k] ≤\leq arr[i] holds for all indices i such that k≤k \leq i << arr.length.

In a single operation, you can choose any index i and replace arr[i] with any positive integer.

Return the minimum number of operations required to make arr kk increasing.

Constraints:

  • 1≤1 \leq arr.length ≤105\leq 10^5

  • 1≤1 \leq arr[i], k ≤\leq arr.length