Amazon Interview Question

I was asked next greater element and house robber style problems (refer leetcode).