Next Greater Node In Linked List
Medium · Linked Lists · about 15 minutes
Asked at Amazon, Google, Microsoft, Bloomberg.
For each node in the list (positions counted from 0), look ahead for the nearest later node holding a strictly larger value. Return an array whose entry i is that larger value for node i, or 0 when no later node is larger.