Two classes of n students each stand in two rows for a photo. Every student in the back row must be strictly taller than the one directly in front.
Given heights of both classes, determine if a valid arrangement exists. Example: class1 = [5, 8, 1, 3, 4], class2 = [6, 9, 2, 4, 5]. Can you arrange them?
The constraint is strict inequality, so equal heights in the same column break the rule. Your strategy: sort both classes and check if every back-row student is taller than the corresponding front-row student.