#3159

Find Occurrences of an Element in an Array

pupil · 530 · lc medium +28 · 73.3% accepted · 181 likes · top 83%

Description

Given an integer array nums, a query array queries, and an integer x, for each queries[i] find the index of the queries[i]-th occurrence of x in nums. Return -1 for any query where that many occurrences do not exist.

Code

1
2
3