Yahoo Interview Question

Two state dynamic programming and graph. I have to say I am totally cooked.