Problem Submissions Solution

Number of NGEs to the right

Difficulty: Medium

Acceptance: %

Points: 30.00

You are given an array of N integers and Q queries, where each query provides a specific index in the array. For each query, you need to determine how many elements to the right of the given index are strictly greater than the element at that index. Return the results as a list NGEs[], where NGEs[i] represents the count of such elements for the i-th query.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(N * queries).

Expected Space Complexity: O(queries).

Constraints:
  • 1 <= N <= 10^4
  • 1 <= arr[i] <= 10^5
  • 1 <= queries <= 100
  • 0 <= indices[i] <= N - 1
Companies:
Amazon Microsoft Walmart Google
Topics:
Stack
Locked Content
Access Restricted: Please Login to access the code editor and test cases.