You are given a circular integer array nums and an integer array queries.
For each query index queries[i], find the minimum circular distance to another index j such that j \neq queries[i] and nums[j] == nums[queries[i]]. If no such index exists, the answer for that query is
Return an array containing the answer for each query in queries.
Note: The circular distance between two indices
iandjin an array of lengthnis defined as.
Constraints:
queries.length nums.length
nums[i]
queries[i] nums.length
You are given a circular integer array nums and an integer array queries.
For each query index queries[i], find the minimum circular distance to another index j such that j \neq queries[i] and nums[j] == nums[queries[i]]. If no such index exists, the answer for that query is
Return an array containing the answer for each query in queries.
Note: The circular distance between two indices
iandjin an array of lengthnis defined as.
Constraints:
queries.length nums.length
nums[i]
queries[i] nums.length