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

Question

A PM asks how long an experiment must run. You need required_per_variant visitors in each of num_variants equally sized groups, and the site delivers daily_visitors eligible visitors per day (all of whom enter the experiment). The experiment runs whole days, so any partial final day rounds up. Compute total = required_per_variant * num_variants and return the smallest whole number of days d with d * daily_visitors >= total, which equals ceil(total / daily_visitors) = (total + daily_visitors - 1) / daily_visitors using integer division. All inputs are non-negative and daily_visitors >= 1. Example: required_per_variant = 5000, num_variants = 2, daily_visitors = 3000 returns 4.

Implement
days_needed(required_per_variant: int, num_variants: int, daily_visitors: int) → int
Examples
in[5000,2,3000]out4
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.