Tap here to switch tabs
Problem
Submissions

Problem: Reverse K Subarrays

med
30 min
Try to solve the Reverse K Subarrays problem.

Statement

You are given an integer array nums of length n and an integer k, where n is divisible by k.

Divide the array into k contiguous subarrays of equal size. Reverse each of the k subarrays in place and return the modified array.

Constraints:

  • 1≤1 \leq n ==== nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000

  • 1≤1 \leq k ≤\leq n

  • n is divisible by k.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Reverse K Subarrays

med
30 min
Try to solve the Reverse K Subarrays problem.

Statement

You are given an integer array nums of length n and an integer k, where n is divisible by k.

Divide the array into k contiguous subarrays of equal size. Reverse each of the k subarrays in place and return the modified array.

Constraints:

  • 1≤1 \leq n ==== nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000

  • 1≤1 \leq k ≤\leq n

  • n is divisible by k.