#Leetcode problem matrix spiral

1 messages · Page 1 of 1 (latest)

tiny wave
#

Think recursively

trim egret
#

There is an approach but its kinda long because it requires 4 pointers

tiny wave
#

You can easily use recursion to solve this problem

#

By shrinking the 4 corners everytime

trim egret
#

@tiny wave recursion isnt optimal

#

because youll be using extra space

tiny wave
#

You can solve the problem recursively, but do the process iteratively

#

Think recursively, but maybe use a while loop to solve it

radiant plover
#

Its basically simulation

#

Hint: use one while loop inside 4 loops for 4 sides