Second next greater element

Company: Bree_7oct

Difficulty: medium