Interview Question


Country: United States




Comment hidden because of low score. Click to expand.
0
of 0 vote

this is a question of an ongoing placement process by WAP,so it's requested not to answer it till 26th aug.Students querying about this who registered in WAP current placement process will be rejected.

- mukaosu chang August 21, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

What is WAP? How would they know who asked for the answer here :)

- AndyS August 22, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

There is no @in the matrix

- vivek.sit August 21, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if there is no @ in the matrix then find the min distance between S and G
for example in the above path is 4

- suman roy August 22, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

the question is
########
#@....G#
##.##@##
#..@..S#
#@.....#
########

here
* 'S' means the orienteering start.
* 'G' means the orienteering goal.
* '@' means an orienteering checkpoint.
* '.' means an opened-block that players can pass.
* '#' means a closed-block that players cannot pass.


It is allowed to move only by one step vertically or horizontally (up, down, left, or right) to the
next block.
Other types of movements, such as moving diagonally (left up, right up, left down and right down)
and skipping one or more blocks, are NOT permitted.
* You MUST NOT get out of the map.
* Distance is to be defined as the number of movements to the different blocks.
* You CAN pass opened-blocks, checkpoints, the start, and the goal more than once if necessary.
* You can assume that parameters satisfy following conditions.
* 1 <= width <= 100
* 1 <= height <= 100
* The maximum number of checkpoints is 18.

The aim of this game is to arrive at the goal (G) from the start (S) with the shortest distance.
However, the players have to pass all the checkpoints (@) on the map.

- robert11223366554 August 22, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

if the input is given in this format .....i arrived at a solution without "@" constraints
by doing BFS and got the solution b/w start and goal which is simple maze problem ....but iam stuck ...i mean i am not understanding how to tackle @ symbols...it wouls be great if someone could come up with a solution or a hint

- robert11223366554 August 22, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I hv solved it usin backtracking

- tanuj aasawat August 22, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

if we use backtracking ..time complexity will b more ...exponential time complexity

- shailendra August 23, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

How to solve it other than backtracking?

- mohit August 23, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think sm1 is posting using my name. This is the first and last post by me on this blog. I strongly censure the above act.

- Tanuj Kr Aasawat August 23, 2014 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More