GOOGLE_SDE
BAN USER- 0of 2 votes
Answersgiven a N x N matrix find the no. of times a word is present in that matrix. constraints you can move in 3 directions from one cell 1. forward , 2. down 3. diagonal . Find all teh occurance of all the word
- GOOGLE_SDE in United States
forward means right (x+1,y)
down mean (x,y+1)
diagonal means (x+1,y+1)
it can be done with BFS. {search the no. of occurance of a given word example "sachin" in the whole NxN matrix}
w | s | r | t | g | g|
a | a | c | h | i | n |
k | c | h | u | j | j |
o | h | i | n | y | q |
in this sachin can be found out 3 times.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
Answersgiven a N x N matrix find the no. of times a word is present in that matrix. constraints you can move in 3 directions from one cell 1. forward (x+1,y), 2. down (x, y+1) 3. diagonal(x+1,y+1) . Find all the occurance of all the word
- GOOGLE_SDE in India
solution approach --> BFS or DFS
eg:-
forward means right (x+1,y)
down mean (x,y+1)
diagonal means (x+1,y+1)
it can be done with BFS. {search the no. of occurance of a given word example "sachin" in the whole NxN matrix}
w | s | r | t | g | g|
a | a | c | h | i | n |
k | c | h | u | j | j |
o | h | i | n | y | q |
in this sachin can be found out 3 times.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
Answersgiven a N x N matrix find the no. of times a word is present in that matrix. constraints you can move in 3 directions from one cell 1. forward , 2. down 3. diagonal . Find all teh occurance of all the word
- GOOGLE_SDE in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 3 votes
AnswersIn 1-9 keypad one key is not working. If some one enters a password then not working key will not be entered. You have given expected password and entered password. Check that entered password is valid or not
- GOOGLE_SDE in United States
Ex: entered 164, expected 18684 (you need to take care as when u enter 18684 and 164 only both will be taken as 164 input)| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer
forward means right (x+1,y)
down mean (x,y+1)
diagonal means (x+1,y+1)
it can be done with BFS. {search the no. of occurance of a given word example "sachin" in the whole NxN matrix}
w | s | r | t | g | g|
a | a | c | h | i | n |
k | c | h | u | j | j |
o | h | i | n | y | q |
in this sachin can be found out 3 times.
greedy or dynamic is optimal in this such kind of problems
- GOOGLE_SDE December 16, 2013