← Questions
Task delay times from the farthest smaller priority
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Task priorities are given in an array and processed from right to left. A task's delay time is the distance from it to the farthest task on its right that has a smaller priority, or 0 if none does. For [8, 2, 11, 4, 9, 4, 7] the answer is [6, 0, 4, 0, 2, 0, 0]. The O(n^2) scan times out; find an O(n log n) solution.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
