seating student program in java
Answers
Answered by
0
Answer:
Given an integer N, a binary string S and an array W[]. S denotes the sequence of N * 2 persons entering the hall, where 0 denotes a boy and 1 denotes a girl. W[] denotes the width of seats in each row, where each row consists of exactly 2 seats. The task is to find a possible arrangement of the persons entering the hall such that following conditions are satisfied:
A boy chooses a row in which both seats are empty. Among all such rows, he chooses the one with the minimum width.
A girl chooses a row in which one seat is occupied by a boy. Among all such rows, she chooses the one with the maximum width.
Similar questions