Advertisement
ivandrofly

Dynamic progrmaming: House Robber

May 6th, 2024
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.23 KB | None | 0 0
  1. int Rob(int[] houses, int i)
  2. {
  3.     if (i >= houses.Length) return 0;
  4.     return Math.Max(
  5.         houses[i] + Rob(houses, i + 2),
  6.         Rob(houses, i + 1));
  7. }
  8.  
  9. https://youtu.be/73r3KWiEvyk?list=PLot-Xpze53lcvx_tjrr_m2lgD2NsRHlNO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement