3159. Find Occurrences of an Element in an Array
You are given an integer array
nums
, an integer arrayqueries
, and an integerx
.For each
queries[i]
, you need to find the index of thequeries[i]th
occurrence ofx
in thenums
array. If there are fewer thanqueries[i]
occurrences ofx
, the answer should be -1 for that query.Return an integer array
answer
containing the answers to all queries.
1 | class Solution { |