Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

House Robber

XPChallenge Points: 10
levelLevel: Easy

You are given an array of integers where each element represents the amount of money stored in a house.
You want to maximize the total money you can collect without taking money from two adjacent houses, as that would trigger the security alarm.

Your task is to calculate the maximum total amount that can be collected following this rule.

Example 1:

Input: nums = [5, 1, 2, 10, 6]

Output: 15

Example 2:

Input: nums = [3, 8, 4, 9, 10, 2]

Output: 19

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result