Amazon Interview Report
- 0of 2 votes
AnswersIn the Amazon Office, Employees are use to sit in cubical offices and all the offices are connected with some other offices, but they are not arranged in any well defined order. Offices are connected means they are sharing their walls with other offices. There are two types of Employees in Amazon i.e. 'Testers' and 'Developers'. Manager of Amazon don't want any 'Tester' and 'Developer' to sit in nearby cubical office, it means there should not be any shared wall between two 'Testers'/'Developers'.
- vinod January 24, 2014 in India
Input:- First line consist of an integer n, which is number of common walls.
Next n lines consist of 2 integers a and b, which represents the Office Number between which the wall is being shared.
Output: - Print 'Yes', if condition of the manager can be satisfied and print 'No' if not.
Example: -
1-2-3
|
4
Office number 2 is sharing its 3 walls with Office 1,3 & 4.....that is why if Office 2 has a 'Developer' than Office 1,3 & 4 cannot have any 'Developer'.
INPUT:-
3
1 2
2 3
2 4
Output: -
Yes
Any better approach then DFS i.e. O(V+E)..??| Report Duplicate | Flag | PURGE
Amazon Intern Trees and Graphs - 2of 4 votes
AnswersSearch in a row wise and column wise sorted matrix
- vinod January 24, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Intern Matrix