cpp implementation of Spiral Matrix II