There are n people lined up, and each have a height represented as an integer. A murder has happened right in front of them, and only people who are taller than everyone in front of them are able to see what has happened. How many witnesses are there?
Input: [3, 6, 3, 4, 1]
We need to traversal backwards and maintain the max during the process.
// time: O(n) space: O(1)