Code Room
CodingEasycod-g1367
Subject Ab test mathLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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).

Implement
replay_power_pct(diffs_bps: list[int], mde_bps: int) → int
Examples
in[[120,-40,300,90],100]out50
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.