var s : Int = 0
var e : Int = matrix.count-1
s = s + 1
e = e - 1
for i in stride(from: 0, to: matrix.count, by: 1)
for j in stride(from: i+1, to: matrix[i].count, by: 1)
In place means your algorithm works on the original array other than copy value from a new rotated array. In place doesn't mean no extra space. You can solve lots of problems in place with a Visited Helper array .