Wayfair HackerRank Round
Anonymous User
905

Time Duration: 50 Minutes
Assessment Type : 2 DSA Questions
Cutt-off for next round: 60 Points

Question 1 : (75 Points)

You are given a binary maze where every cell has an obstacle (denoted by 1) or free ( denoted by 0).
You are standing at (0,0) and want to reach (n-1,m-1) which is the last cell of the maze.
You can move from current cell to four directionally adjacent cells at a magintude of atmost K iff all cells from
current cell to that cell doesn't have obstacles!

Find Minimum number of moves required to reach last cell starting from origin!
If its not possible to go to last cell, return -1.

Example 1:
Maze =
[ 0 0 0 0]
[ 0 1 1 0]

k = 3

Answer : 2 (Jump from (0,0) ->(0,3) -> (1,3) whichi s last cell.

Example 2 :
Maze =
[ 0 1 0 0 0 0 0 0 0 ]
[ 1 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 0 0 0 0 0 ]
[ 0 0 0 0 0 0 0 0 0 ]

k = 4

Answer = -1 (We will not be able to move to any of the adjacent cells since we have obstacles on all paths!)

Question 2 : (50 Points)
You are given dictionary of words as strings and given set of queries strings.
Return all words in dictionary which are anagrams for current query in sorted order!!

Example :

Dictionary : ["duel" , "speed" , "dule", "cars"]
Queries : ["spede" , "deul"]

Answer:

[
[ "speed"],
["duel" , "dule"]
]

Comments (3)