Amazon | Barraiser Round | Grid navigation
Anonymous User
1738

Round only had 1 questions a hell lot of follow ups. Was completely tired by the end of it.

Coding

  1. NxM Grid consists of Energy points, hurdles.
  2. Energy points: position with >=0 value
  3. Hurdles: position with -1 value
  4. Top left: (0,0)
  5. Moves: Up, down, left, right
  6. 1 move requires 1 energy points.
  7. Initially you have 0 points and if at any instance your points <= 0, you die.
  8. Upon Visiting a position you collect all the energy points at that positions value becomes 0.
  9. You are allowed to visit a position multiple times.

Example
Grid
[
[ 2, 0, 0, -1],
[ 0, 0, 2, -1],
[ 5, -1, 0, 0],
[ 0, -1, 10, 0]
]

Starting - (0,0)
Ending - (3,3)
Answer-> 9
Path -> (0,0) (1,0) (2,0) (1,0) (1,1) (1,2) (2,2) (3,2) (3,3)

Follow up 1
Moves can be made in diagonal direction

Follow up 2
You are allowed to skip steps while moving.
Moves now include: (x+2,y) (x,y+2) (x-2 ,y) (x,y-2)

Follow up 3
Return the path.

Feedback
I was able to solve till the first 2 follow ups under 30 mins
Took me a lot of to and fro to get the 3rd follow up done (had to add constraints in order get the question done.)

Leadership principle

  • Talk about any interesting project I have done.
  • Talk about a feature I did within high time constraints
  • Gave this interview on 17th Aug. So do not remember the last leadership principle question. But it was pretty similar to the above 2.
Comments (5)