Coding Challenge · INTERMEDIATE
Given an array of integers, find the distance to the next greater element for each element in the array. The next greater element for an element x is the first greater element on the right side of x in the array. If there is no greater element, the distance is 0.