Solutions
From the direct clues in the given information we can infer that-
P lives on 5th floor.
Judge lives on the floor which is 5th from the top which means he must be on 4th floor.
M is a driver and Driver lives on the floor which is even prime number which is second floor.
There are only three floors between Judge's floor and X's floor.
Floor
|
Persons
|
Profession
|
8
|
X
|
-
|
7
|
-
|
-
|
6
|
-
|
-
|
5
|
P
|
-
|
4
|
-
|
Judge
|
3
|
-
|
-
|
2
|
M
|
Driver
|
1
|
-
|
-
|
From the indirect clues in the given information we can infer that-
Z is not the neighbour of P and driver hence Z must be on 7th floor.
Teacher is the neighbour of Z but he does not live on top floor So he must be on 6th floor.
Only two persons live between teacher and O so O must be on 3rd floor.
Y is not the neighbour of O and Y is not a teacher. Y must be on 1st floor.
N is not the judge which means N will be on 6th floor and he must a teacher. Now we are left with only one person ie. Q who will be on 4th floor.
Floor
|
Persons
|
Profession
|
8
|
X
|
-
|
7
|
Z
|
-
|
6
|
N
|
Teacher
|
5
|
P
|
-
|
4
|
Q
|
Judge
|
3
|
O
|
-
|
2
|
M
|
Driver
|
1
|
Y
|
-
|
Shopkeeper does not live on top floor and he is not the neighbour of N and Judge.
So shopkeeper must be on 1st floor.
Manager and Accountant both are neighbours but Manager is not the neighbour of teacher.
So X would be Manager and Z will be Accountant.
No we are given that Advocate does not live on 3rd floor So Advocate would be on 5th floor.
And O would be an engineer.
The final arrangement is-
Floor
|
Persons
|
Profession
|
8
|
X
|
Manager
|
7
|
Z
|
Accountant
|
6
|
N
|
Teacher
|
5
|
P
|
Advocate
|
4
|
Q
|
Judge
|
3
|
O
|
Engineer
|
2
|
M
|
Driver
|
1
|
Y
|
Shopkeeper
|