In a normal array, there's an easy way to acquire the next immediate larger element. We'd stay on one element, and then would simply keep moving up on the indices, performing a comparison against each.
This would continue until we hit the end of the array.
xxxxxxxxxx[5, 4, 3, 6]// starting at 5, we'd check each number// 5 > 4...// 5 > 3...// eventually we'd see 6 > 5OUTPUT
Results will appear here.