KatInterview

Two-Year Show Profit: Renewal vs. New Launch

Math & Bit ManipulationAuto-graded · 19 test cases
MediumAuto-gradedMath & Bit Manipulationarithmeticexpected-valuebreak-even

Last updated

Compute two-year profits for two show options, blend the new show's outcomes by success probability, and find the break-even probability.

Two-Year Show Profit: Renewal vs. New Launch

A streaming service must choose how to spend the next two years: keep an established series running, or launch a fresh one. Both options earn money and cost money every year. The fresh launch additionally burns a one-time setup cost before it airs.

Here are the fixed numbers, all monetary amounts in millions of dollars:

ItemEstablished showFresh launch
Annual viewers5 million7 million if it succeeds; 4 million if it fails
Revenue per viewer per year1515
Fixed production cost per year5060
One-time setup costnone20

In any scenario, the audience holds steady across both years. Revenue and production cost are each paid twice (once per year); the setup cost is paid only once. Ignore discounting, taxes, and anything not listed.

The probability that the fresh launch succeeds is an unknown input p — a number in the closed range from 0 to 1.

Write a function that returns a list of five floats, in this exact order:

  1. Established show, two-year profit — it does not depend on p.
  2. Fresh launch profit if it succeeds — setup cost subtracted once.
  3. Fresh launch profit if it fails — same structure, using the failure audience.
  4. Expected two-year profit of the fresh launch at probability p, i.e. the probability-weighted blend of outcomes 2 and 3.
  5. Break-even success probability — the value of p at which the expected fresh-launch profit exactly equals the established show's profit.

Details that matter:

  • Two-year revenue is (annual viewers × revenue per viewer) counted twice; two-year production cost is (annual fixed cost) counted twice.
  • The expected profit is p * success_profit + (1 - p) * failure_profit, evaluated literally even when p falls outside [0, 1] — do not clamp or validate it.
  • The break-even probability is (established_profit - failure_profit) / (success_profit - failure_profit), computed from the four fixed numbers, so it stays the same regardless of p. Do not round it.
  • Return plain floats, even for values that come out whole.

Constraints

  • 0 <= p <= 1 for meaningful inputs (the function must still evaluate the formula for any finite float).
  • All four fixed inputs are constant; only p varies between calls.
  • Returned list always has exactly 5 elements, in the order stated above.
  • Exact float arithmetic is expected; no rounding at any step.

Examples

Example 1

Input: compare_show_profit_options(0.5)

Output: [50, 70, -20, 25, 0.7777777777777778]

Example 2

Input: compare_show_profit_options(7)

Output: [50, 70, -20, 610, 0.7777777777777778]

Example 3

Input: compare_show_profit_options(0.8)

Output: [50, 70, -20, 52, 0.7777777777777778]

Hints

Hint 1

Work out each scenario's two-year revenue and two-year cost separately, then subtract — and remember the setup cost appears exactly once, not once per year.

Hint 2

The success and failure branches share everything except the audience number, so their profits differ only through revenue.

Hint 3

The break-even probability makes expected profit equal to the established profit: solve p * success + (1 - p) * failure = established for p.