Solved LeetCode program · 783 of 1,000
#1019 · Next Greater Node In Linked List
Original English source
Keep a shared scores holding 2, 7, 4, 3, and 5. The answers is an empty list of whole numbers. Keep a shared following of 0.
To seek from start (a whole number) with value (a whole number). Set following to 0. The begin is start plus 1. The finish is the last position of scores.
For every probe from begin to finish.
If item probe of scores is more than value, set following to item probe of scores, stop.
For every spot from 0 to the last position of scores.
The value is item spot of scores. Seek from spot with value. Place following into answers.
The line is empty text.
For each answer in answers.
If the length of line is more than 0, Place "," into line. Place format whole number answer as text into line.
Show line.
Expected stdout
7,0,5,5,0