Maximize the Profit as the Salesman
Choose non-overlapping house ranges to maximise gold, with a prefix table indexed by the house where each offer ends.
Choose non-overlapping house ranges to maximise gold, with a prefix table indexed by the house where each offer ends.