Empirical power

Write codeEasy10 minNetflix and Meta style

Your task

To sanity-check an experiment plan, your team replays it against historical traffic: each replay simulates the full experiment and records the measured uplift in basis points (possibly negative). The plan's empirical power is the share of replays whose uplift reached the minimum detectable effect. Given diffs_bps, the list of replay results, and an integer mde_bps, return floor(100 * qualifying / total) where qualifying counts entries with diffs_bps[i] >= mde_bps. If there are no replays, return -1. Example: diffs_bps = [120, -40, 300, 90], mde_bps = 100 returns 50 (2 of 4 qualify).

Examples

replay_power_pct(diffs_bps: list[int], mde_bps: int) -> int
Example 1
Inputreplay_power_pct([120, -40, 300, 90], 100)
Output50