I was asked this question in telephonic round of Google. Couldn't come to any good solution .. Any idea how to approach ?
There are multiple students in a class.. They speak various languages . For example (input),
Students: [S1, S2, S3, S4, S5]
Languages: [L1, L1, L2, L2, L3]
Teacher of their class wants student not to talk to each other. She can do this by making student sit in such a fashion that , for every student , adjacent student speaks different langauge.
Output :
(1 possible arrangment)
[S1, S3, S2, S4, S5]
Assumption :