Consider a row of n houses represented as an array: A[1..n], where the phrase "next door neighbor" having its natural meaning. Each resident is assigned a "fun factor" F[1..n], which represents how much fun they bring to a party. Your goal is to maximize the fun of a party that you are arranging, but with the constraint that you cannot select three consecutive neighbors. (So for example, if you invite the A[5] and A[6] family, you cannot invite the A[4] or A[7] families.) Give an efficient algorithm to select the guest list.
Please provide the Notation, optimality, recurrence, and algorithm.