Choose the Highest Shipment Priority
Context
A warehouse must decide which of four shipments deserves attention first. Each shipment has an integer priority score: larger scores mean more urgent handling, while negative scores indicate low urgency. Find the greatest score among the four shipments.
Problem
Write a function that receives the priority scores for exactly four shipments and returns the greatest score. Begin with one supplied score as the current best, compare it with each remaining score, and replace the current best whenever a larger score is found. Equal scores, negative values, zero, and repeated greatest values must be handled through ordinary integer comparisons. The returned value must be one of the supplied scores.
Examples
priority_scores = [12, 7, 19, 4]19priority_scores = [-8, 0, -3, -12]0priority_scores = [6, 6, 2, 6]6Constraints
4 <= len(priority_scores) <= 4-1000000 <= priority_scores[i] <= 1000000 for every i- Types:
priority_scoresis int[]; result is int
Function signature
def highest_shipment_priority(priority_scores: list[int]) -> int
priority_scoreslist[int]- The integer priority scores for exactly four shipments.
- returns int
- The greatest priority score among the four supplied shipment scores.
Adapted from MBPP problem task_672 (CC BY 4.0). Rewritten, extended and verified by Iksha.