Google | Phone Screen | USA | L4? | Reject
Anonymous User
1110

Hi All,

Just want to give back to the community. I recently had my phone interview and I got the following question. I can't remember the exact details but it went something like this.

You are given a rules for two points on a 2d matrix. The rule consists of (N|S|E|W|NE|NW|SE|SW), you must tell if it is a vaild configuration.

Input 1:

1 N 2
2 N 3
3 N 1

Output : False, because 3 cannot be north of 1.

Input 2:

1 N 2
2 N 3
1 N 3

Output : True

For couple mins, I couldn't even figure out what this question was. I came to the conclusion that it was a graph question and I had to detect cycles.

Let me know if you have any questions and I can try to answer.

Comments (3)