Back to Practice
#0107

Linear Seating Order

MediumAptitude25 min20 XP

Problem

A, B, C, D sit in a row facing north. B is immediately right of A. C is not at an end. D is left of A. Find the order from left to right.

Why This Matters

Arrangement questions test careful translation of language into positions.

Examples

Example 1
Inputfour people in a row
OutputD C A B

C must occupy an inner seat and D must be left of A.

Constraints

  • Return the exact structure requested.
  • Handle the edge cases mentioned in the prompt.
  • Prefer clear logic over clever one-liners.
CodeReasoning
A, B, C, D sit in a row facing north. B is immediately right of A. C is not at an end. D is left of A. Find the order from left to right.
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
Inputfour people in a row
ExpectedD C A B

C must occupy an inner seat and D must be left of A.

Hidden Test Categories
facing south variantnot immediately next to cluefive-person extension