Hello and thank you so much for your efforts. I would really suggest improving the solution explanation for better understanding by adding at least an example to make it more clear why did you choose this approach. One very big advantage of me subscribing to Educative is illustrations and good explanations.
For example, you can take a number like 10 and explain with an illustration how the queue could be an advantage by illustrating the solution.
Type your question above this line.
Course: https://www.educative.io/collection/5642554087309312/5724822843686912
Lesson: https://www.educative.io/collection/page/5642554087309312/5724822843686912/5769079931535360