Adobe Interview Question
Developer Program EngineersCountry: India
Interview Type: In-Person
Good answer @Barney
The thing will be like this
First ant will reach at the opposite side of the same plane with respect to the corner in which it's right now.
So then distance covered (If A is the length of one side):
X1=A*(5^(.5))/2
Then again he will move in the same way:
X2=A*(5^(.5))/2
So total distance = A*(5^(.5))
In case of cube the minimum distance is daignal of the cube but as mention in question that ant cant fly so we will first cover the daignal of the surface in which ant is placed currently then we will cover the edge that is luying to the target corner from the current position
shortest distance would be=diagonal of the surface+edge
diagonal of the surface=sqrt(2)a
edge =a
shortest distance = a(sqrt(2)+1)
Its simple . Just open the cube box . and join the two diagonally opposite corners .
- Shobhit July 03, 2012I mean first ant will move to the middle of the opposite side on the same plane from the staring point .
Then from that point , it'll start move to the corner (which lies diagonally opp to the starting point )
Total length covered = a*(5^0.5)