← Akuna Capital Interview Insights
The math itself isn't bad once you work out that net profit equals stake times (1/p minus 1), so stake ends up being 1000p divided by (1 minus p).
First, clarify the problem: we need to find the stake S such that a win yields exactly $1000 net profit, given decimal odds of 1/p. The net profit on a win is S*(1/p - 1), so set S*(1/p - 1) = 1000 and solve for S. Then, discuss rounding to two decimal places and handling invalid inputs like p <= 0 or p >= 1.
Pro tip: Mention that in a real trading system, you'd also consider rounding conventions (e.g., round half up) and potential floating-point precision issues, and that invalid inputs should be rejected with clear errors rather than silently returning a value.
Restate the problem: given p in (0,1), decimal odds are 1/p, and we want a net profit of $1000 on a win. Confirm that 'net profit' means profit excluding the stake, and that the stake is the amount wagered.
Let S be the stake. A win returns S*(1/p) total, so net profit = S*(1/p) - S = S*(1/p - 1). Set this equal to 1000 and solve: S = 1000 / (1/p - 1) = 1000 * p / (1 - p).
Check that p is strictly between 0 and 1. If p <= 0 or p >= 1, the odds are invalid (division by zero or negative odds). Return an error or a sentinel value as appropriate.
Calculate S using the formula, then round to two decimal places. Be mindful of floating-point precision; consider using a small epsilon or a decimal library if exact rounding is critical.
Verify with sample values: e.g., p=0.5 gives S=1000; p=0.25 gives S≈333.33; p=0.1 gives S≈111.11. Also test edge cases like p very close to 0 or 1.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.