Solved LeetCode program · 623 of 1,000
#0851 · Loud and Rich
Original English source
Keep a shared quiet holding 3, 2, 5, 4, 1, and 0. Keep a shared edges holding 1, 2, 3, 4, and 5. Keep a shared starts holding 0, 1, 3, 3, 5, and 5. Keep a shared counts holding 1, 2, 0, 2, 0, and 0. Keep a shared answers holding 0, 1, 2, 3, 4, and 5.
To settle from person (a whole number).
For every offset from 0 to item person of counts minus 1.
The source is item (item person of starts plus offset) of edges. Settle from source. The voice is item source of answers. If item voice of quiet is less than item person of quiet, set item person of answers to voice.
For every person from 0 to 5.
Settle from person.
The line is empty text.
For each value in answers.
If the length of line is more than 0, Place "," into line. Place format whole number value as text into line.
Show line.
Expected stdout
5,5,2,5,4,5