K30

House Robber I

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: NUMERIC

Problem Statement & Objective

You are a professional robber planning to rob houses along a street. Adjacent houses have security systems; determine the maximum money you can rob without alerting police.

Function Signature (Python)

house_robber_i(houses: list[int]) -> int

Input & Output Contract

Output Rule:Maksimum para miktarı.

System Constraints

0 <= evler.length <= 100
0 <= evler[i] <= 400

Example Execution Walkthrough

evler = [1, 2, 3, 1] -> 1. ev (1) + 3. ev (3) = 4
evler = [2, 7, 9, 3, 1] -> 2 + 9 + 1 = 12

Example Test Scenarios (3)

Example 1
Input:[[1,2,3,1]]
Expected Output:4
Example 2
Input:[[2,7,9,3,1]]
Expected Output:12
Example 3: Boş Sokak
Input:[[]]
Expected Output:0
Loading Python Editor...
Input Parameters
[
  [
    1,
    2,
    3,
    1
  ]
]
Expected Output
4