FastPrepKth Greater Element Index to the Right
Problems/Kth Greater Element Index to the Right

Kth Greater Element Index to the Right

Concentric AI logoConcentric AI● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Concentric AI new grad online assessment. The report gives the main task and what the interview was like. We rebuilt the function signature, the tie rule, the examples, and the limits as close to the report as we could. Our version is about 90% the same as the reported question.

For each array position, scan strictly to its right and consider positions whose value is strictly greater than the current value.

Return the 1-based index of the kth such position in left-to-right encounter order, or -1 if fewer than k exist. Equal values do not qualify.

Function

kthGreaterIndexes(nums: int[], k: int) → int[]

Examples

Example 1

nums = [2,4,0,9,6]k = 2return = [4,5,5,-1,-1]

For value 2, the second greater position is 4; other positions are evaluated independently.

Example 2

nums = [3,1,5,2,4]k = 1return = [3,3,-1,5,-1]

Return each next encountered greater position.

Example 3

nums = []k = 1return = []

Empty input gives an empty result.

Constraints

  • 0 <= nums.length <= 5000.
  • 1 <= k <= nums.length when the array is nonempty.

More Concentric AI interview questions

  • Find the Intersection Node of Two Linked ListsOA · Seen Sep 2026
  • Count Students Outside Their Sorted PositionsOA · Seen Aug 2026
  • Maximum Profit Under a Bitwise OR LimitOA · Seen Aug 2026
  • Minimum Weighted Manhattan Travel CostOA · Seen Aug 2026
  • Rearrange a Linked List from Alternating EndsONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Payment Partner RoutingStripe · OAStripe interview questions
  • Bank Accounts with Balance HistoryMeta · OAMeta interview questions
  • Capping Portfolio WeightsCapstone Investment Advisors · OA
  • Repeated Mirror XORMathWorks · OAMathWorks interview questions
  • Stacked Item and Category DiscountsPalantir · OAPalantir interview questions
  • Stabilize Student Test ScoresVirtu Financial · OAVirtu Financial interview questions
  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Minimize Task Resource ConsumptionNVIDIA · OANVIDIA interview questions
  • Index of the Maximum After Left RotationsChubb · OAChubb interview questions
  • Leaves Remaining After WindCresta · OACresta interview questions
All Concentric AI interview questionsSee Concentric AI hiring insights
Saved
class Solution {
    public int[] kthGreaterIndexes(int[] nums, int k) {
        // write your code here
    }
}
Checking account…