You are given a nums that undergoes a continuous transformation process.
Initially, at minute nums.
During the first nums.length minutes, the leftmost element is removed from the array at each minute until the array becomes empty.
During the subsequent nums.length minutes, elements from the original nums are appended back to the array one by one in their original order until the array is fully restored.
This cycle repeats indefinitely, alternating between removing all elements from left to right and appending all original elements from left to right.
You are also given a queries, where queries[j] = [time_j, index_j]. For the index_j of the array at minute time_j. If the index is out of bounds or the array does not contain an element at index_j at that minute, the answer is
Return an array of integers representing the answers to all queries in the given order.
Constraints:
nums.length
nums[i]
n queries.length
n
queries[j].length
time_j
index_j nums.length
You are given a nums that undergoes a continuous transformation process.
Initially, at minute nums.
During the first nums.length minutes, the leftmost element is removed from the array at each minute until the array becomes empty.
During the subsequent nums.length minutes, elements from the original nums are appended back to the array one by one in their original order until the array is fully restored.
This cycle repeats indefinitely, alternating between removing all elements from left to right and appending all original elements from left to right.
You are also given a queries, where queries[j] = [time_j, index_j]. For the index_j of the array at minute time_j. If the index is out of bounds or the array does not contain an element at index_j at that minute, the answer is
Return an array of integers representing the answers to all queries in the given order.
Constraints:
nums.length
nums[i]
n queries.length
n
queries[j].length
time_j
index_j nums.length