Hi all,

I was asked this question in Amazon interview.

There is a matrix suppose(3x4). And I traverse through each position only
once in spiral movement like (0,0),(0,1), (0,2),(0,3),(1,3),(2,3) ... so on
in spiral direction.
 --- Until this point its quite easy and gave famous solution which comes
in i think 3 loops.
 But here came an update of question. from the matrix i have given a point
(0,2) , i have to print next point that comes in spiral direction. If the
point is center of matrix, it should print -1.
---So what i did was updated the loops starting values which gave solution
but he asked to optimize and i got stucked there.

Any otherway to accomplish same?


Regards,
Adi Srikanth.
Mob No 08886888066
Personal Pages: http://bit.ly/adisrikanth

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to