Left Rotation to a Strictly Increasing Array
Updated
Problem statement
Given a nonempty integer array numbers, return how many cyclic left shifts make it strictly increasing.
If no cyclic left rotation works, return -1. Return the unique valid shift when one exists.
Function
rotationToIncreasing(numbers: int[]) → intExamples
Example 1
numbers = [3,4,5,1,2]return = 3Rotating left by three produces [1,2,3,4,5].
Example 2
numbers = [1,2,3]return = 0The array is already strictly increasing.
Constraints
1 <= numbers.length <= 100000
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Build the Task HierarchyPendo · OA
- Lowest Number in an Open RangeCapital One · OACapital One interview questions
- Missing IntervalsIBM · OAIBM interview questions
- Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Count Valid Square PairsAuxoAI · OA
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Two SumAmazon · OA · PHONE SCREEN
- Competition Winner and Runner-Up (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
- Find Words That Can Be Formed by CharactersTabaPay · OA