Amazon Interview Report
- 1of 1 vote
AnswersA robot is placed on an infinite 2D grid. The robot is initially facing the east direction. It moves in a spiral movement turning to its left after each move. The movements are given as an input array.
- maneesh.chaturvedi February 20, 2013 in India
For example, assume the Robot is initially at (x,y) and the movement array is [4,3,5,2,1,6,...].
After 1st move, Robot will be at (x+4,y)
After 2nd move, Robot will be at (x+4,y+3)
After 3rd move, Robot will be at (x-1,y+3)
After 4th move, Robot will be at (x-1,y+1)
After 5th move, Robot will be at (x,y+1)
After 6th move, Robot will be at (x,y+7)
and so on.
Find the minimum area of the rectangle which can enclose all these points.| Report Duplicate | Flag | PURGE
Amazon Principal Software Engineer Algorithm
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.