Skip to content

Latest commit

 

History

History
5 lines (3 loc) · 367 Bytes

File metadata and controls

5 lines (3 loc) · 367 Bytes

Idea behind the solution

The secret here is just to track how many elements has been printed, as well as keep tracking the current element printed, checking whether it is possible to print the next element or if it is needed to change the "print direction".

Also, to remember which element has been printed, null is set on the element that has just been printed.