Produce valid student lineup from parent array | Intuit Interview Question