public static int getMaxSum(int[] nums){
        int len = nums.length;
        if(len == 1) return nums[0];

        int[] memo = new int[len];
        memo[0] = nums[0];
        memo[1] = Math.max(nums[1], memo[0]);

        for(int i = 2; i < len; i++){
            memo[i] = Math.max(memo[i - 1], memo[i - 2] + nums[i]);
        }
        return memo[len - 1];
    }