Confusing statement on 8.5

#1

Looking at the example from GeeksforGeeks (https://www.geeksforgeeks.org/number-buildings-facing-sun/) of the Sunset problem, and considering that in the statement we have “windows to the east of a building of equal or greater height cannot view the sunset”, if we were giving the array:

[7, 4, 8, 2, 9]

We would expect [0, 2, 4] for the return value (which corresponds to values 7, 8, 9). However if we run the code given we observe we get 4 (for value 9), which is the equivalent of assuming the sun is at the east and windows to the west of a building cannot view the sunset, which is the opposite of the problem statement.

Isn’t that a mistake?

0 Likes