As reported: Omnissa (formerly VMware) MTS-2, Bengaluru (2026), Java team, round 1 DSA — three problems, each from brute force to better to optimal, with code; this was the first: rotate an array to the right by
ksteps.
Given an array nums, rotate it to the right by k steps, in place. This is LeetCode 189 — Rotate Array.
Example 1
nums = [1,2,3,4,5,6,7], k = 3 -> [5,6,7,1,2,3,4]
Example 2
nums = [-1,-100,3,99], k = 2 -> [3,99,-1,-100]
Constraints: 1 ≤ nums.length ≤ 10^5; -2^31 ≤ nums[i] ≤ 2^31 − 1; 0 ≤ k ≤ 10^5.
Code runner format: one JSON value per line: nums, then k (LeetCode's format). Implement rotate(nums, k) modifying nums in place; the harness prints nums.