K01

Packages Above Average

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: NUMERIC

Problem Statement & Objective

The weighing conveyor at a shipping hub records the weight of each processed package in grams sequentially throughout the day. The facility manager asks: "How many packages weigh strictly above average?" Given a list of package weights, return the count of packages that are STRICTLY GREATER than the ARITHMETIC AVERAGE of the list.

Function Signature (Python)

packages_above_average(weights: list[int]) -> int

Input & Output Contract

Output Rule:Number of elements strictly greater than average. Elements equal to average are not counted. Returns 0 for an empty list.

System Constraints

0 <= gramlar.length <= 10^5
0 <= gramlar[i] <= 10^6

Example Execution Walkthrough

gramlar = [300, 500, 700, 900]
total = 2400, average = 600
Elements strictly greater than 600: 700, 900 -> result 2

Example Test Scenarios (3)

Example 1
Input:[[300,500,700,900]]
Expected Output:2
Example 2: Small Array
Input:[[10,20,30]]
Expected Output:1
Example 3: Equal Groups
Input:[[100,100,200,200]]
Expected Output:2
Loading Python Editor...
Input Parameters
[
  [
    300,
    500,
    700,
    900
  ]
]
Expected Output
2