https://medium.com/@techsuneel99/nearest-greater-element-to-the-left-of-every-element-in-javascript-9530609ff55