A teacher in a class with N students has noticed that some students have formed their own groups and hence prevented intermingling of students to get those students to mix with each other, the teacher has decided a seating pattern.The seating pattern is very simplistic viz. every boy should sit next to a girl and every girl should next to a boy. They are all seated in one line. It is also mandatory that no two boys sit together, and no two girls sit together. Your task is to make the above happen with minimum number of swaps between as-is situation to desired solution
def arr_stud(N):
n_b = int(input('no of boys: '))
n_g = int(input('no of girls: '))
if n_b == n_g:
return 2
else:
return 0
Comments
Leave a comment