FastPrepMaximum Rating Threshold Count
Problems/Maximum Rating Threshold Count

Maximum Rating Threshold Count

Amazon logoAmazon● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Amazon intern online assessment. The report gives the goal about the rating threshold and a solution that sorts in descending order. We chose the method name, the examples, and the number limits.

You are given a non-empty integer array ratings. Find the largest integer k where at least k of the entries in ratings are greater than or equal to k. Return that k.

The entries you count can be anywhere in the array. They do not have to sit next to each other. If no positive value of k works, return 0.

Function

maximumRatingThreshold(ratings: int[]) → int

Examples

Example 1

ratings = [3,0,6,1,5]return = 3

Three ratings are at least 3: 3, 5, and 6. For k to be four, you would need four ratings that are at least 4, but only two are. So the answer is 3.

Example 2

ratings = [1,1,1]return = 1

All three ratings are at least 1, so k can be one. No rating is at least 2, so k cannot be two or more. The answer is one.

Example 3

ratings = [0,0,0,0]return = 0

No rating is at least 1, so no positive k works. The answer is zero.

Constraints

  • 1 <= ratings.length <= 200000.
  • 0 <= ratings[i] <= 10^9.

More Amazon Online Assessment questions

  • Lexicographically Largest IdentifierOA · Seen Nov 2026
  • Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
  • Top K Frequent ElementsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fill One Exact-Length Binary WindowOA · Seen Nov 2026
  • Minimum Grid InconvenienceOA · Seen Nov 2026
  • Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026
  • Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Get Smallest Base SegmentOA · Seen Nov 2026
  • Minimum Cost of Left and Right PropagationOA · Seen Nov 2026
  • Maximum Equal-Bit Pairs in a SubsequenceOA · Seen Nov 2026

Similar questions at other companies

  • Count Lamps Lighting Each PointAirbnb · OAAirbnb interview questions
  • Merge IntervalsApple · OA · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
  • Earliest Meeting Time for All EmployeesCapital One · OACapital One interview questions
  • Capping Portfolio WeightsCapstone Investment Advisors · OA
  • Count Servers With No Requests in a Time WindowIBM · OAIBM interview questions
  • Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
  • Largest Team Where Every Pair OverlapsWalmart · OAWalmart interview questions
  • Maximum Distinct Values After Unit AdjustmentsBirla Pivot · OA
  • Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Minimize Task Resource ConsumptionNVIDIA · OANVIDIA interview questions

Interview reports that mention this question

  • Amazon Intern OA Problems: Every Task We Have (Part 2 of 5)

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
  • Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)
See Amazon hiring insights
Saved
class Solution {
    public int maximumRatingThreshold(int[] ratings) {
        // Write your code here.
    }
}
Checking account…