I have the following problem:
Given an array $A$, I need to construct an array $B$ such that $B[i]$ is the minimum $j>i$ such that $A[j]>A[i]$, or Null if no such $j$ exists.
For example, if $A = [23,45,13,10,33]$ then $B = [2,Null,5,5,Null]$.
The algorithm should run in time $\Theta(n)$.