Loading...

The Category Ranker

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
senior

Problem

The feature store emits thousands of scored records across dozens of categories, and the serving layer needs only the top performers from each group for real-time inference. Write a function that groups records by category and returns the top N per category, sorted by value descending. Ties should preserve the original insertion order.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.