This question evaluates a candidate's competency in designing end-to-end validation, error handling, and operability for a REST API, covering input schema validation, authentication and authorization, rate limiting, idempotency, error classification, partial-failure strategies, timeouts/retries, observability, and graceful degradation in the System Design domain. It is commonly asked to assess how candidates reason about building robust, production-grade services that handle malformed or oversized payloads and partial failures, and it tests practical application of system-level design principles rather than low-level algorithmic implementation.

You are designing a REST endpoint that computes the top-K most frequent values from a client-provided array. The focus is on end-to-end validation, robustness, and operability rather than the counting algorithm itself.
Assume the endpoint is:
Design the validation and error-handling strategy covering:
Login required