Cyclic Shift to Strictly Descending Array
Complete the function below. The function receives the full standard input as a single string and must return the exact standard output value for the described problem.
Original prompt
Problem
Given an integer array nums of length n and an integer t (0 <= t < n). Define one cyclic shift as moving the last t elements of the array to the front (i.e., a right rotation by t).
Determine whether applying this shift once makes the array strictly descending.
Return true/false.
Note: The original description is slightly ambiguous about whether t is given or you may choose t. This version assumes t is given and you check the result after one shift.
Input
Integer array nums Integer t
Output
true or false Constraints (suggested) 1 <= n <= 2e5 0 <= t < n -1e9 <= nums[i] <= 1e9
Examples
nums=[3,2,1], t=0 → true nums=[1,3,2], t=1 → false nums=[2,1,3], t=2 → false nums=[4,3,2,1], t=1 → false nums=[2,1], t=1 → false
Complete solveOneCyclicShiftStrictlyDescending. It has one parameter, String input, containing the full stdin payload. Return the exact stdout value as a string, either "true" or "false".
input = "3\n3 2 1\n0" return = "true"
The returned string must match the expected standard output for the sample input.
Use the limits and requirements stated in the prompt.
- Compare Counts Around PivotOA · Seen Jun 2026
- Reconstruct Landmark JourneyOA · Seen Jun 2026
- Count House Segments After DestructionOA · Seen May 2026
- Count Numbers with Even Number of DigitsOA · Seen May 2026
- Laser Robot Safe PathOA · Seen May 2026
- Longest Same-Character SubstringOA · Seen May 2026
- Dynamic Wall Building and Range QueryOA · Seen May 2026
- Queue Check-in Simulation with Capacity LimitOA · Seen May 2026
public String solveOneCyclicShiftStrictlyDescending(String input) {
// write your code here
}