Count Failing, Passing, and Honor-Roll Scores
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Online Assessment
Given test scores, return three counts in this order: failing, passing without honor roll, and honor roll. A score below50 fails. A score above80 is honor roll. Scores from50 through80 inclusive are passing without honor roll.
### Constraints and Clarifications
Scores are expressed on the percentage scale used in the example;80 means80%, not0.8. No numerical size bounds are reported. Use finite numeric scores and apply the stated comparisons without inventing clamping behavior. An empty list returns[0,0,0].
### Example
For[81,90,23,44,51,50,80,49], return[3,3,2]. The middle category includes both50 and80.
### What a Strong Answer Covers
Use mutually exclusive conditions, preserve the output order, and account for every input exactly once. Explain the two strict boundary comparisons.
### Follow-up Questions
- Why do separate uncoordinated if statements risk counting one score twice?
- Which boundary examples distinguish the three categories?
Overview: Count test scores in three exact categories using strict cutoffs below50 and above80. Preserve the required output order and verify that boundary scores50 and80 belong to the middle group.
Given a list of finite numeric test scores on a percentage scale, return three counts in this order: failing, passing without honor roll, and honor roll. A score below 50 fails. A score above 80 earns honor roll. Scores from 50 through 80 inclusive pass without honor roll. Treat 80 as 80 percent, not 0.8. Apply these comparisons directly without clamping scores. Implement countScoreBands(scores). An empty list returns [0, 0, 0].
Example: scores = [81, 90, 23, 44, 51, 50, 80, 49], output [3, 3, 2].
Constraints
- scores contains finite numeric values on the stated percentage scale; no numerical size bound is supplied.
- Score < 50 is failing; 50 <= score <= 80 is passing without honor roll; score > 80 is honor roll.
- An empty list returns [0, 0, 0].
- Do not clamp scores before classifying them.
Examples
Input: ([],)
Expected Output: [0, 0, 0]
Explanation: No scores means every category count is zero.
Input: ([49],)
Expected Output: [1, 0, 0]
Explanation: Forty-nine is strictly below fifty.
Hints
- The categories include both exact boundary scores.
- Return the counts in the order requested by the statement.