Skip to content
Tutorials Center
My learning

Topics

Lesson 68 of 86 ยท Puzzles and Arrangements

Linear Seating Arrangements

Solve row seating puzzles with left and right clues, neighbor conditions and between-clues. Build the layout step by step and check it with a solver.

A seating puzzle gives you a handful of people, a row of seats and a list of clues such as "R sits at one of the ends" or "S sits second to the right of R". Your job is to work out who sits where. These puzzles are everywhere in bank, campus-placement and management exams because they test one thing very cleanly: can you keep several small facts in your head (or on paper) at once and combine them without error?

Linear arrangements, where everybody sits in one straight row, are the simplest family. Once you master them, circular tables, floors and schedules are the same idea in a different shape. In this lesson you learn the vocabulary, a repeatable method, two full worked puzzles, and a small program that solves any row puzzle by brute force, so you can check your own answers.

Getting the vocabulary right

Most mistakes in seating puzzles are not logic mistakes; they are reading mistakes. Fix these meanings before you start.

  • Facing north. Unless the puzzle says otherwise, everybody faces north. Draw the row on paper with north at the top, and the person's left is the left of your drawing. This is the convention in this lesson.
  • Facing south. If people face south, their left is the right of your drawing. A common trap: "P sits to the immediate left of Q" then puts P to the right of Q on paper.
  • Immediate (or "next to", "adjacent") means exactly one place away.
  • Second to the right of R means two places to the right: if R is at position 2, the person is at position 4.
  • Between. "S sits between P and Q" normally means somewhere between them; "immediately between" means directly in the gap. If exactly one person sits between P and Q, the positions differ by 2.
  • Extreme end means position 1 or position n. "Either end" has the same meaning.
  • Third from the right end in a row of n people is position n - 2 counted from the left.

A quick position conversion helps again and again: in a row of n people, position k from the left is position n - k + 1 from the right. In a row of 8, the 3rd person from the left is the 6th from the right.

A method that works every time

flowchart TB
    A["Read all clues once<br/>and note the facing direction"] --> B["Draw empty slots 1 to n"]
    B --> C["Place the exact clues first<br/>(ends, third from right, middle)"]
    C --> D["Place relative clues<br/>(second to the right of R)"]
    D --> E{"Any person<br/>with two options?"}
    E -->|"yes"| F["Write both cases<br/>and test the remaining clues"]
    E -->|"no"| G["Fill the last seats"]
    F --> G
    G --> H["Re-read every clue<br/>against the final row"]

Exact clues first, relative clues second, a case split only when you have to, and a final check against every clue.

The order of the steps is the real trick. Clues that name a fixed seat ("at an end", "sits third from the right end", "sits exactly in the middle") are anchors. Relative clues ("second to the right of R") are chains hanging from an anchor. Negative clues ("U does not sit at either end") are almost never useful early, but they are perfect for deciding between two leftover cases at the end.

Worked puzzle 1: six friends in a row

Six friends P, Q, R, S, T and U sit in a row facing north. Clues:

  1. R sits at one of the extreme ends.
  2. S sits second to the right of R.
  3. P sits third from the right end.
  4. T is an immediate neighbor of S.
  5. U does not sit at either end.

Step 1: anchors. Clue 1 puts R at position 1 or 6. Clue 2 says S is two places to the right of R. If R were at position 6 there is no room on the right, so R is at position 1 and S at position 3.

Step 2: another anchor. Clue 3: third from the right end in a row of 6 is position 4, so P is at position 4.

Step 3: a neighbor clue. The neighbors of S (position 3) are positions 2 and 4. Position 4 is already P, so T must be at position 2.

Step 4: the negative clue. Positions 5 and 6 are left for Q and U. Position 6 is an end, and clue 5 says U is not at an end. So U is at 5 and Q at 6.

The final row from left to right is R, T, S, P, U, Q.

flowchart LR
    s1["1: R"] --- s2["2: T"] --- s3["3: S"] --- s4["4: P"] --- s5["5: U"] --- s6["6: Q"]

The finished row seen from above, facing north: positions run from the left end to the right end.

Notice that every step was forced: we never guessed. If a puzzle makes you guess early, you probably missed an anchor.

A solver you can trust

A computer solves such puzzles in the dumbest possible way: try every arrangement and keep those that satisfy all clues. Six people have 720 arrangements; eight people have 40,320. That is nothing for a computer, and it gives you a way to check that your manual answer is the only answer. The script below also prints how many arrangements survive after each clue, which shows how clues shrink the search.

JS Brute-force solver for row puzzles

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Each clue is a small function that receives the seat numbers. You can edit a clue, delete one, or add your own and watch the count change. A well-made puzzle ends with exactly one arrangement; if you delete clue 5, two remain, and that is exactly why the puzzle needs it.

Worked puzzle 2: seven people and a "between" clue

Seven people A, B, C, D, E, F and G sit in a row facing north. Clues:

  1. A sits exactly in the middle of the row.
  2. G sits immediately to the left of A.
  3. Exactly one person sits between B and G.
  4. E sits at an end and C sits immediately to the left of E.
  5. F sits third to the right of D.

Anchors. Seven seats, so the middle is position 4: A = 4. G is immediately left: G = 3.

The between clue. One person between B and G means B is at 3 - 2 = 1 or 3 + 2 = 5. Two cases.

The end clue. E is at an end and C is immediately left of E. If E were at position 1, nobody could sit to its left. So E = 7 and C = 6.

Remaining seats. Positions 1, 2 and 5 are left for B, D and F. Clue 5 says F is three places to the right of D: the only pair of free seats that are 3 apart is D = 2 and F = 5. That leaves B = 1, which was one of our two cases from clue 3, so everything agrees.

Final row: B, D, G, A, F, C, E. Check clue 3: between B (1) and G (3) sits only D. Correct.

JS Check puzzle 2 and see how each clue helps

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Facing south, or both ways

Some puzzles seat everyone facing south. Nothing about the logic changes; only the words "left" and "right" swap relative to your drawing. A reliable way to avoid slips is to draw the row once from the observer's view (north at the top) and convert each clue as you read it: "P is to the immediate left of Q, facing south" becomes "P is immediately to the right of Q in my drawing".

In harder versions, half the row faces north and half faces south. Then the same clue is read differently for different people. Write a small "N" or "S" under each person as soon as you learn it, and translate each clue about left and right before drawing anything.

When two seats are interchangeable after a clue, leave them as a pair such as "(Q/U) (Q/U)" and keep going. Later clues usually break the tie, and you avoid guessing.

Common traps

  • Mixing up "to the left of" and "immediately to the left of". The first only says "somewhere on the left"; the second means exactly one place. "Second to the left" means exactly two places.
  • Counting positions from the wrong end. Use position k from the right is n - k + 1 from the left, and write it down.
  • Forgetting a person can sit at either end. Write both cases when a clue says "at an end" and test them against everything else.
  • Stopping when you have a plausible answer. A good puzzle has exactly one arrangement. Re-read each clue against the finished row; one failing clue means a mistake.

For the next topic, where the row bends into a circle and "left" depends on which way people face, move on to circular tables.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. In a row of 8 people facing north, X is the 3rd from the left end. What is X's position from the right end?

    Position from the right = n - k + 1 = 8 - 3 + 1 = 6, so X is 6th from the right.
  2. 2. In worked puzzle 1 the final row is R, T, S, P, U, Q. Who sits second to the left of Q?

    Q is at position 6. Second to the left means position 4, which is P.
  3. 3. People in a row face south. P sits to the immediate left of Q. Looking at the row from above with north at the top, who is further to the left (west)?

    Facing south, a person's left side points east. So P is on Q's east side, and Q is further to the west (left in the drawing).
  4. 4. In a row of 20 people, A is 7th from the left and B is 9th from the right. How many people sit between them?

    B is 20 - 9 + 1 = 12th from the left. People between A (7th) and B (12th): 12 - 7 - 1 = 4.
  5. 5. In worked puzzle 2 the final row is B, D, G, A, F, C, E. How many people sit between B and E?

    B is at position 1 and E at position 7, so 7 - 1 - 1 = 5 people sit between them.

Summary

  • Fix the facing direction first; facing south swaps left and right relative to a drawing with north at the top.
  • Position k from the left is position n - k + 1 from the right; the number of people between two seats is the difference minus one.
  • Place exact clues first, then relative clues, then use negative clues to break ties; split into cases only when a clue truly allows two places.
  • Always check the finished row against every clue, and trust a solver script only after you understand why it agrees.

Next: Circular and Square Seating Arrangements, where facing the center or outward decides what left and right mean.