re: Challenge - Print Spiral VIEW POST


Should the space complexity be constant or linear? Probably O(1) since O(n) would allow you to build an array.


I wanted to allow to build up one single line before printing. I think that would result in a space complexity of O(n). That allows to build an array, but not to build an array containing all entries of the spiral (being O( n2 )).

Code of Conduct Report abuse