#3488

Closest Equal Element Queries

expert · 1100 · lc medium +32 · 32.8% accepted · 120 likes · top 10%

Description

Given a circular array nums and queries, for each query index queries[i], find the shortest circular distance from position queries[i] to any other position containing the same value.

If no duplicate exists, the answer for that query is -1.

Return the array of results.

Code

1
2
3