Approach hintTry it first, then revealHide
The first and last houses are adjacent, so at most one of them is robbed. Run the linear House Robber DP twice, once without the first house and once without the last, and take the better result.
The first and last houses are adjacent, so at most one of them is robbed. Run the linear House Robber DP twice, once without the first house and once without the last, and take the better result.