Max Element Indexes After Rotations
Updated
Problem statement
You are given an array a of distinct positive integers and an array rotate. For each value in rotate, perform that many left circular rotations on the original array a, not on the result of any previous query.
Return an array where each element is the 0-based index of the maximum value in a after the corresponding number of left circular rotations.
Function
getMaxElementIndexes(a: int[], rotate: int[]) → int[]Examples
Example 1
a = [1, 2, 3]rotate = [1, 2, 3, 4]return = [1,0,2,1]After one left rotation, the array is [2,3,1], so the maximum value 3 is at index 1. The other rotation counts produce maximum indexes 0, 2, and 1.
Constraints
1 <= a.length <= 1051 <= rotate.length <= 1050 <= rotate[i] <= 105- All values in
aare distinct positive integers.
More Snowflake Online Assessment questions
- Safest Shortest Path Through a GridOA · Seen Nov 2026
- Find Valid SET Card TriplesOA · PHONE SCREEN · Seen Nov 2026
- LFU CacheOA · ONSITE INTERVIEW · Seen Nov 2026
- Minimum Index Distance Between Person and CakeOA · PHONE SCREEN · Seen Nov 2026
- Minimum N-ary Tree Depth DeletionsOA · PHONE SCREEN · Seen Nov 2026
- Sum of Binary Tree Boundary NodesOA · PHONE SCREEN · Seen Nov 2026
- Optimal TransferOA · Seen Oct 2026
- Generating Login CodesOA · Seen Sep 2026
- String Formation (Also for AI/ML Software Engineer Intern :)OA · Seen Sep 2026
- Minimum Clicks Between Wiki PagesOA · PHONE SCREEN · Seen Sep 2026