What yesterday adds to the state
transcript
A fitness app plans training days. Each day is a rest, easy or hard. A hard workout needs a rest the day before. Which plan earns the most points?
Twenty days have three to the power twenty plans. The rule still leaves about fifty four million. Trying them all is far too slow.
A hiker writes two lines each evening. The total walked, and whether she rested. Tomorrow's plan needs only those two. Those two lines are the state.
Try one number for each day. Easy is one and one, hard is five and five. It adds five and five for ten. That uses two hard days in a row. The best legal plan earns six.
Keep two numbers for each day. Easy is three, four, two. Hard is seven, nine, five. Rested is the best total ending in a rest. Worked is the best total ending in a workout. A hard workout reads only the rested number.
One number was not enough. Add the fact the rule needs. Full breakdown in the lecture.