The Uncertainty of Politics
Jump to navigation
Jump to search
- Order meetings 1->N by start time
- solution is expected value of 1, or E(1)
- E(n) calculated as max of
- E(n+1) meaning we didn't attend this meeting
- 1 + sum (E(n+x) * p(x)) where p(x) is the probability of x being the first meeting we can go to after this meeting ends
- memoize
memoization array is 10^4 big, and at max, iterate over 10^4 future meetings....so 10^8 is fast enough. Note that 10^4 is a pretty good hint the runtime is parabolic-ish.
Can easily flip problem to DP by starting with the last meeting, which has E=1, since you always attend it if you can.