Skip to interview prep
Apexed

1. Revenue by region

EasyPandas & NumPy

Each row is an order with region, units and price. Return [region, revenue] pairs where revenue = units × price, sorted by revenue descending (ties by region name).

Input rows arrive as a list of dictionaries; build a DataFrame with pd.DataFrame(rows).

Example 1

Input: [{'region': 'EU', 'units': 2, 'price': 10}, {'region': 'US', 'units': 1, 'price': 50}]
Output: [['US', 50], ['EU', 20]]

Constraints

  • Return built-in Python numbers

Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor

Run checks these cases; the expected output comes from the reference solution. Submit judges all 3 hidden and sample tests.

Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.

Revenue by region — coding interview practice — Apexed