Loading...
Loading...
Loading...
A tutorial room has c seats. Students join one by one; the room refuses a student who is already inside or arrives when every seat is taken.
Write Classroom with a String[] of size c, a count, String join(String name) and String list().
join NAME.JOINED NAME, ALREADY NAME or FULL NAME. Then one line Class (k): N1 N2 …, or Class (0): - when empty.Example
Input
2 4 join Asha join Ravi join Asha join Meena
Output
JOINED Asha JOINED Ravi ALREADY Asha FULL Meena Class (2): Asha Ravi
Asha is already inside; Meena finds the room full.
Try the problem first. Open one hint at a time.
Check "already inside" before "full", as the samples show.
Loop only up to count when searching and when printing.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor