FactSet interview question

Print all 1 3 2 array pattern in time and space both O(n).