Skip to content
CampusEduX

House Robber

Mediumjavapythonccppjavascript

Given the money in each house along a street, find the maximum amount you can collect without robbing two adjacent houses.

Input Format

The first line contains an integer N. The second line contains N space-separated non-negative integers.

Output Format

Print the maximum amount that can be robbed.

Related Problems

  • 0/1 Knapsack
    Medium · java, python, c, cpp, javascript
    Solve Problem
  • Longest Common Subsequence
    Medium · java, python, c, cpp, javascript
    Solve Problem
  • Longest Increasing Subsequence
    Medium · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...