Sunset Hills

An array of buildings is facing the sun. The heights of each building from West to East is given in an integer array. You have to tell which buildings will be able to see the sunset. Write a program that prints how many buildings and which buildings will be able to see the Sunset given the Array [3, 2, 4, 7, 6, 9]. The output should look something like this:4 --> [3, 4, 7, 9]

The Sunset Hills coding challenge is intended to assess a candidate’s ability to work with Arrays.This challenge or a slight variation has been used by technology companies such as Amazon and was also featured on a Geeks for Geeks blog post titled “Amazon Interview Experience | Set 189 (For SDE-1)”