Available question text
For each query k, return the index of the k-th occurrence of x in nums (or -1 if fewer than k occurrences exist). Because nums and queries can be large, this is typically solved by preprocessing the list of indices where nums[i]==x to answer each query quickly.
Related questions
Continue with questions that share topics or the same question type.
- Count Occurrences of an Element in a Sorted Array
Coding
- Find First and Last Position of Element in Sorted Array
Coding · Array · Binary Search
- Find Next Greater Element in Sorted Array
Coding
- Find Second Largest Element in an Array
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3159. Find Occurrences of an Element in an Array
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source