You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed and is protected by a security system with a color code.
You are given two integer arrays
numsandcolors, both of lengthn, wherenums[i]is the amount of money in thei^thhouse andcolors[i]is the color code of that house.You cannot rob two adjacent houses if they share the same color code.
Return the maximum amount of money you can rob.
1 | class Solution { |