Question
A token starts at position 0 on the number line. Each step it moves +1 with probability p and -1 with probability (1-p), where p is given as a float. Return the probability, rounded to 6 decimal places, that the token reaches position +a before it reaches position -b (a and b are positive integers; the walk is absorbed at +a or -b). Constraints: 1 <= a, b <= 1000, 0.0 < p < 1.0.
reach_a_before_neg_b(a: int, b: int, p: float) → float[1,1,0.5]out0.5State 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.