Quiz
Question 1 of 6. 0 correct, 0 incorrect.
A charity collector visits a row of four houses that would give 2, 1, 1 and 2, but may not knock at two neighbouring houses. What is the largest total they can collect?
Hint
Let best(i) be the largest total from the first i houses, and decide whether house i is visited.