Math, asked by majorsknath, 9 hours ago

A robber is planning to rob across a street. He can't rob two adjacent houses
as this would alert the police. Given information about money of each house,
How much money can robber rob?
4, 2, 5, 2, 1, 7, 8,4​

Answers

Answered by Johnsonmijo
1

Answer:

If a robber cannot steal from 2 adjacent houses and the money of each house are 4,2,5,2,1,7,8,4 then he can either rob 18 or 15

Step-by-step explanation:

Given

The robber cannot rob adjacent house

Money in houses are

4,2,5,2,1,7,8,4

If he starts with first house,

Then he should go next to third, then to fifth and to the seventh

So he get a total of

4+ 5+1+8 = 18

If he starts with the second house,

Then he should go next to the fourth house, then to 6 th house and at last to the eighth house

Then he will get

2+2+7+4 = 15

So he either gets 18 or 15

Answered by amitnrw
1

Robber can rob 20 (  4 + 5 + 7 + 4)  if He can't rob two adjacent houses from the 4, 2, 5, 2, 1, 7, 8,4​

Given:

  • A robber is planning to rob across a street.
  • He can't rob two adjacent houses as this would alert the police.
  • money of each house  4, 2, 5, 2, 1, 7, 8,4​

To Find:

  • How much money can robber rob

Solution:

There are Total 8 houses and robber can not rob Adjacent houses so Maximum houses can be robbed are 4

Different possible cases so that atleast 4 houses are robbed

R means Robbed

4        2        5        2          1         7        8         4           Total

R       -          R         -          R        -         R         -           18

R        -         -          R         -         R         -          R          17

R       -         R          -          -         R         -          R         20

R        -         R        -          R         -         -           R         14

-        R         -          R         -          R        -          R          15

Hence, Maximum Amount can be robbed is 20

Robbed amounts are  4 + 5 + 7 + 4  = 20

Similar questions