Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Placement Aptitude (Quant, Logical, Verbal)  Module 12 – Arrangements, relations and puzzles

Ranking and linear seating arrangements

Ranking and seating in a row for aptitude tests: positions from both ends, rows that face north or south, and a method that places the tightest clue first.

  • Beginner
  • 30 minutes
  • Examples run with Node.js 24.21.0, Python 3.14.8 and quickjs 0.32.0
  • By MySmartCoPilot
Free core, Pro depth: 8 of 30 minutes free
Free: Positions from both ends · Rows that face north or south · Place the tightest clue first · 2 more sections. With a pass: 3 in-depth parts and 3 interview answers, about 22 minutes.

What you will learn

  • Solve ranking problems from the top, bottom, left and right
  • Arrange people in a row from clues about positions and neighbours
  • Track left and right correctly when people face north or south

A ranking question gives someone’s position counted from two ends of a list, a queue or a row, and asks for the total, a missing position or the number of people between two others. Linear seating arrangements put people in a row and give clues about seats and neighbours. Both rest on one count: in a line of n people, a position from one end plus the position from the other end is n + 1. Rows add one trap: left and right belong to the sitters, so they flip when the row faces you. The method: draw the seats, place the most constrained person first, split the rest into cases and cross out each case that breaks a clue. This lesson works five examples, checks a seven-person row against all 5,040 orders, and ends with an untimed set of ten.

Positions from both ends

Ranking questions count positions from the two ends of one line. If Ishaan is 14th from the top of a merit list and 23rd from the bottom, 13 names are above his and 22 below, so the list has 36 names. Adding the two positions counts him twice:

total=position from one end+position from the other end−1\text{total} = \text{position from one end} + \text{position from the other end} - 1
Asked Rule Example
The total Add the two positions, subtract 1 14th from the top and 23rd from the bottom: 36
A position from the other end Total − position + 1 22nd from the right of 30: 9th from the left
People between two others Count both from one end, then the gap minus 1 9th and 12th from the left: 2 between

From opposite ends, total − a − b counts the people between only while the two have not passed each other; a negative result means they overlap, so convert one position first.

Rows that face north or south

Draw the row as on a map, north at the top, and number the chairs from your left. Your left side is towards the west when you face north, so people facing north have their left on your left. People facing south face you: their left is on your right, and every “left” clue moves towards the right-hand end of your drawing.

Two rows of five chairs: facing north, the sitters’ left is your left; facing south, their left is your right.Left and right belong to the sittersNFacing north: their backs are to you12345their lefttheir rightFacing south: they face you12345their righttheir left

Which way is left depends on which way the row faces

Text description of the diagram

Two rows of five chairs, numbered 1 to 5 from your left, with north at the top of the page. In the upper row an arrow above each chair points north: the sitters have their backs to you, so their left is on your left, towards chair 1, and their right is towards chair 5. In the lower row an arrow below each chair points south: the sitters face you, so their right is towards chair 1, on your left, and their left is towards chair 5, on your right. A clue such as "second to the left of the person in chair 3" therefore means chair 1 in the upper row and chair 5 in the lower row.

Read clue words strictly: “immediately left” is the next chair, “second to the left” skips one chair, “somewhere to the left” allows any chair on that side, and “between” means the space separating the two people named, who are never counted.

Place the tightest clue first

  1. Draw the chairs, number them from your left and write the facing above them.
  2. Place what is certain: an end, the middle chair, a fixed position.
  3. Join people that a clue ties together, such as “immediately left of”, into blocks.
  4. When a clue allows two places, draw one row per case and carry both forward.
  5. Cross out a case as soon as a clue fails; stop when one row is left or the question has one answer in every row.

The same steps solve linear seating arrangements of any size; only the number of cases grows.

Five solved examples

  1. Total. Ishaan is 14th from the top and 23rd from the bottom: 14 + 23 − 1 = 36 names.

  2. Swapped places. In a canteen queue, Riya is 7th from the front and Sameer 11th from the back. They swap, and Riya is now 15th from the front. She stands where Sameer stood, 15th from the front and 11th from the back, so the queue has 25 people.

  3. Overlap. In a row of 30, Asha is 12th from the left and Kabir 22nd from the right. Kabir is 30 − 22 + 1 = 9th from the left, so 2 people sit between them, not 30 − 12 − 22 = −4.

  4. Facing south. Five friends face south, Pia in the middle chair. Om sits second to her left, your right: chair 5.

  5. A seven-person row. At a college-fest stall, Anil, Bela, Chetan, Divya, Esha, Farhan and Gauri sit in a row of seven chairs facing south, towards the visitors. Divya sits at one end. Exactly two people sit between Divya and Gauri. Bela sits to the immediate left of Gauri. Chetan sits third to the right of Esha. Anil is not a neighbour of Chetan. Farhan sits somewhere to the right of Anil.

    Divya is in chair 1 or 7, so Gauri is in chair 4 either way, and Bela, on Gauri’s left (your right), in chair 5. Chetan sits three chairs towards your left from Esha, which fits only Esha in 6 and Chetan in 3. With Divya in chair 7, Anil must avoid Chetan and take chair 1, leaving no chair on his right for Farhan, so that case fails. With Divya in chair 1, Anil takes chair 7 and Farhan chair 2: Divya, Farhan, Chetan, Gauri, Bela, Esha, Anil.

The program tries all 7! = 5,040 orders and keeps those that fit each clue in turn.

Four rules, and the seven-person row checked against all 5,040 orders JavaScript · row_puzzle.mjs
// The lesson's five solved examples: four ranking and facing rules, then the seven-person stall row checked
// against every possible order of the seven volunteers.

// In a line of people, a position from one end plus the position from the other end counts one person twice.
const total = (fromOneEnd, fromOtherEnd) => fromOneEnd + fromOtherEnd - 1;
const fromOtherEnd = (people, position) => people - position + 1;

console.log(`1. 14th from the top and 23rd from the bottom: ${total(14, 23)} names`);
console.log(`2. Riya stands where Sameer stood, 15th from the front and 11th from the back: ${total(15, 11)} people`);
const kabir = fromOtherEnd(30, 22);
console.log(`3. Kabir is ${kabir}th from the left and Asha 12th: ${12 - kabir - 1} people between them (30 - 12 - 22 = ${30 - 12 - 22}: they overlap)`);
// Chairs are numbered from the reader's left. Facing south, one chair to a sitter's left is one chair to the reader's right.
console.log(`4. Pia in the middle chair, 3 of 5, faces south; Om sits second to her left: chair ${3 + 2}, the reader's right-hand end`);

// 5. Seven volunteers in chairs 1 to 7 from the reader's left, all facing south towards the visitors.
const names = ['Anil', 'Bela', 'Chetan', 'Divya', 'Esha', 'Farhan', 'Gauri'];
const LEFT = 1;
const RIGHT = -1;
const clues = [
  ['Divya sits at one end', (c) => c.Divya === 1 || c.Divya === 7],
  ['Exactly two people sit between Divya and Gauri', (c) => Math.abs(c.Divya - c.Gauri) === 3],
  ['Bela sits to the immediate left of Gauri', (c) => c.Bela === c.Gauri + LEFT],
  ['Chetan sits third to the right of Esha', (c) => c.Chetan === c.Esha + 3 * RIGHT],
  ['Anil is not a neighbour of Chetan', (c) => Math.abs(c.Anil - c.Chetan) !== 1],
  ['Farhan sits somewhere to the right of Anil', (c) => (c.Farhan - c.Anil) * RIGHT > 0],
];

/** Every order of the items (7 items give 7! = 5,040 orders). */
function orders(items) {
  if (items.length <= 1) return [items.slice()];
  const out = [];
  items.forEach((first, i) => {
    for (const rest of orders([...items.slice(0, i), ...items.slice(i + 1)])) out.push([first, ...rest]);
  });
  return out;
}

let rows = orders([1, 2, 3, 4, 5, 6, 7]).map((chairs) => Object.fromEntries(names.map((name, i) => [name, chairs[i]])));
console.log(`5. ${rows.length} possible orders of the seven volunteers`);
for (const [clue, fits] of clues) {
  rows = rows.filter(fits);
  console.log(`   ${clue}: ${rows.length} left`);
}
const fromTheLeft = (row) => names.slice().sort((a, b) => row[a] - row[b]).join(', ');
console.log(`   From the reader's left: ${fromTheLeft(rows[0])}`);

Output

1. 14th from the top and 23rd from the bottom: 36 names
2. Riya stands where Sameer stood, 15th from the front and 11th from the back: 25 people
3. Kabir is 9th from the left and Asha 12th: 2 people between them (30 - 12 - 22 = -4: they overlap)
4. Pia in the middle chair, 3 of 5, faces south; Om sits second to her left: chair 5, the reader's right-hand end
5. 5040 possible orders of the seven volunteers
   Divya sits at one end: 1440 left
   Exactly two people sit between Divya and Gauri: 240 left
   Bela sits to the immediate left of Gauri: 48 left
   Chetan sits third to the right of Esha: 4 left
   Anil is not a neighbour of Chetan: 2 left
   Farhan sits somewhere to the right of Anil: 1 left
   From the reader's left: Divya, Farhan, Chetan, Gauri, Bela, Esha, Anil

Recorded with Node.js 24.21.0 on macOS 26 arm64. To run it yourself: mise exec node@24.21.0 -- node row_puzzle.mjs

Permutation & Combination Calculator Count the orders of a row before you search them: 7! is 5,040 and 8! is 40,320.

Your turn

The exercise counts the people between two others from positions at opposite ends; the ten questions are untimed.

Exercise · Easy · JavaScript

How many people sit between two others

Write between(total, aFromLeft, bFromRight) for a row of total people, where A is aFromLeft-th from the left end and B is bFromRight-th from the right end. All three are whole numbers.

Return the number of people who sit strictly between A and B. Return null when the positions cannot describe two different people of the row: a position below 1 or above total, or two positions that name the same seat.

For the third solved example, between(30, 12, 22) returns 2: Kabir is 9th from the left, Asha 12th, and the people in seats 10 and 11 sit between them. The sample tests include rows where the two people have passed each other, two neighbours, two people at the ends, and positions that do not fit the row.

Starter code · between.mjs

/**
 * A row of `total` people; A is aFromLeft-th from the left end and B is bFromRight-th from the right end. Returns the
 * number of people strictly between A and B, or null when the positions cannot describe two different people.
 */
export function between(total, aFromLeft, bFromRight) {
  // Replace this line with your code (this one subtracts from the total, which fails when the two overlap).
  return total - aFromLeft - bFromRight;
}
The sample tests · between.test.mjs
import { test, assert } from 'mysmartcopilot:test';
import { between } from './between.mjs';

test('Asha and Kabir: 12th from the left and 22nd from the right of 30', () => {
  assert.equal(between(30, 12, 22), 2);
});

test('no overlap: 11th from the left and 19th from the right of 35', () => {
  assert.equal(between(35, 11, 19), 5);
});

test('overlap: 18th from the left and 33rd from the right of 45', () => {
  assert.equal(between(45, 18, 33), 4);
});

test('the two ends of a row of 8', () => {
  assert.equal(between(8, 1, 1), 6);
});

test('neighbours who have not passed each other', () => {
  assert.equal(between(9, 4, 5), 0);
});

test('neighbours who have passed each other', () => {
  assert.equal(between(9, 5, 6), 0);
});

test('two positions that name the same seat', () => {
  assert.equal(between(10, 3, 8), null);
});

test('a position beyond the end of the row', () => {
  assert.equal(between(10, 11, 1), null);
});

test('a position of zero', () => {
  assert.equal(between(12, 4, 0), null);
});
A hint

Check the ranges first. Then turn B's position into a position from the left, total - bFromRight + 1, so that both are counted from the same end. If the two seat numbers are equal, both positions name one seat. Otherwise the people strictly between two seats are the difference of the seat numbers, minus 1, whichever seat is further left.

The sample tests run on this device, in your browser (QuickJS): nothing is sent to mysmartcopilot.com. The first run downloads JavaScript (about 0.6 MB), which is kept for the next runs. A check in your browser is feedback for you, not proof that the code is right for every input.

Ten questions, untimed

10 questions about this lesson. Every answer and why it is right is on the page, behind “Show the answer”. Your score stays in this browser.

  1. Question 1 of 10 Ruchi is 18th from the top and 27th from the bottom of a merit list. How many names are on the list?

    Type a number.

    Show the answer to question 1

    Answer: 44 names

    Adding the two positions counts Ruchi twice, so the list has 18 + 27 − 1 = 44 names: 17 above her, 26 below her and Ruchi herself.

  2. Question 2 of 10 In a row of 32 people, Sohan is 11th from the right. What is his position from the left?

    Type a number.

    Show the answer to question 2

    Answer: 22 th from the left

    Count the people to his left: 32 − 11 = 21 of them, so Sohan is 22nd. The rule is total − position + 1, and 32 − 11 + 1 = 22.

  3. Question 3 of 10 In a row of 26, Tara is 8th from the left and Uma is 9th from the right. How many people sit between them?

    Choose one answer.

    Show the answer to question 3

    Answer: 9

    Uma is 26 − 9 + 1 = 18th from the left, so the seats between them are 9 to 17, which is 9 people. Here the shortcut 26 − 8 − 9 = 9 works too, because the two have not passed each other.

  4. Question 4 of 10 In a row of 18, Vijay is 11th from the left and Wahida is 12th from the right. How many people sit between them?

    Choose one answer.

    Show the answer to question 4

    Answer: 3

    Wahida is 18 − 12 + 1 = 7th from the left, so she sits to the left of Vijay, and seats 8, 9 and 10 lie between them: 3 people. The shortcut gives 18 − 11 − 12 = −5, and a negative result means the two have passed each other.

  5. Question 5 of 10 Xena is 6th from the left of a row and Yusuf is 10th from the right. They swap seats, and Xena is now 17th from the left. How many people are in the row?

    Type a number.

    Show the answer to question 5

    Answer: 26 people

    After the swap Xena sits in Yusuf's old seat, which is 17th from the left and 10th from the right, so the row has 17 + 10 − 1 = 26 people. Her old position, 6th, is not needed.

  6. Question 6 of 10 Seven people sit in a row facing south. Zubin is in the middle chair and Aisha sits third to the left of Zubin. Which chair is Aisha in, counted from your left?

    Choose one answer.

    Show the answer to question 6

    Answer: 7th

    The middle chair of seven is the 4th. Facing south, a sitter's left is your right, so three chairs to Zubin's left is chair 4 + 3 = 7, the end on your right. Answering the 1st chair reads the row as if it faced north.

  7. Question 7 of 10 Five people sit in a row facing north. Bhanu is second from the left end, and Chitra sits to Bhanu's immediate left. Where does Chitra sit?

    Choose one answer.

    Show the answer to question 7

    Answer: At the left end

    Facing north, the sitters' left is your left. Bhanu is in chair 2, so the chair to his immediate left is chair 1, the left end.

  8. Question 8 of 10 A row of people faces south. Which statements are true?

    Choose every answer that is right.

    Show the answer to question 8

    Answer:

    • A sitter's left is on your right as you look at the row.
    • "Second to the right of Hari" skips exactly one chair.

    Facing you, a sitter's left hand is on your right. "Between" means strictly between, so the two people named are not counted. "Second to the right" skips one chair and lands on the next. "Somewhere to the left" allows any chair on that side; only "immediately" means the next chair.

  9. Question 9 of 10 Four friends, P, Q, R and S, sit in a row facing north. P is at the left end, S does not sit next to P, and R sits to the immediate right of Q. Who sits at the right end?

    Choose one answer.

    Show the answer to question 9

    Answer: S

    P takes chair 1, so S is in chair 3 or 4. With S in chair 3, Q and R would need two neighbouring chairs among 2 and 4, which do not touch, so S is in chair 4. Then Q is in chair 2 and R, on Q's right, in chair 3.

  10. Question 10 of 10 The program tried all 5,040 orders of seven volunteers. How many orders are there for six people in a row of six chairs?

    Type a number.

    Show the answer to question 10

    Answer: 720 orders

    Six people can fill the first chair, then five the second, and so on: 6 × 5 × 4 × 3 × 2 × 1 = 6! = 720. Seven people give 7 × 720 = 5,040.

Twelve more ranking and row items, with full working Pro: opens with a Pro, Premium or Ultimate pass

Ranking and row items fall into a few families, each with a trap that catches the hurried reader. Here are twelve new ones, worked line by line, each followed by the wrong answer it is designed to draw.

In this part:

  • Totals and positions from two ends, worked
  • Rows that face north, south or each other, worked
  • Counting rows and spotting ‘cannot be determined’, worked

1 runnable example (JavaScript) · about 5 minutes

Opening this part with your pass…

This part opens with any MySmartCoPilot pass.

  • Pro pass · 1 week₹79$2.99
  • 30 days₹179$5.99
  • 1 year₹1,699$45

One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

What each clue does, measured on the stall row by brute force Pro: opens with a Pro, Premium or Ultimate pass

A row puzzle is fair only when exactly one row fits, or when the question asked has the same answer in every row that fits. This part measures both on the stall puzzle, shows what one missing clue and one misread facing do, and counts how much the order of placing people costs a search.

In this part:

  • Every clue is needed: rows left when one is dropped, measured
  • Two rows, one answer: when to stop early
  • A facing slip reproduced: a wrong row that fits every clue
  • The order of placing people, with numbers
  • An invariant for mixed facing

1 runnable example (JavaScript) · about 3 minutes

Opening this part with your pass…

This part opens with any MySmartCoPilot pass.

  • Pro pass · 1 week₹79$2.99
  • 30 days₹179$5.99
  • 1 year₹1,699$45

One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

A ten-minute timed set, with answers and a rubric Pro: opens with a Pro, Premium or Ultimate pass

Ten row and ranking items, ten minutes on the clock: work them in one sitting, then mark yourself with the worked answers below and see where your score falls in the rubric.

In this part:

  • Ten items for ten minutes
  • Answers, with the shortest working and the trap
  • A rubric for what your score says

1 runnable example (JavaScript) · about 4 minutes

Opening this part with your pass…

This part opens with any MySmartCoPilot pass.

  • Pro pass · 1 week₹79$2.99
  • 30 days₹179$5.99
  • 1 year₹1,699$45

One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

Interview questions

  1. Fresher · Warm-up

    Why is a person's position from the top plus their position from the bottom one more than the number of people in the list?

    Counting from the top, a position counts everyone above the person and the person once. Counting from the bottom, it counts everyone below and the person once more. The two positions together therefore cover the whole list with that one person counted twice, so their sum is the total plus 1. Ishaan, 14th from the top and 23rd from the bottom, gives 37, and the list has 36 names: 13 above him, 22 below him and Ishaan. The same idea converts a position to the other end: in a row of 30, the 22nd from the right is 30 − 22 + 1 = 9th from the left. A three-name list is a quick check: the middle name is 2nd from both ends, and 2 + 2 = 3 + 1.

  2. Fresher

    In a row of 25, Neel is 8th from the left and Owen is 20th from the right. A classmate works out 25 − 8 − 20 = −3 and says the question is faulty. Find how many people sit between them, explain the classmate's error and give a check.

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page. First step and follow-ups

  3. Fresher

    A seven-person row puzzle leaves two rows after all its clues, but the question asks only who sits in the middle chair, and that person is the same in both rows. Do you answer, mark "cannot be determined" or keep searching? Defend the choice with an example.

    Model answer, Pro. First step and follow-ups

  4. Fresher

    Five people sit in a row facing south. A clue says "Hema sits second to the right of Ishaan", and a friend draws Hema two chairs to Ishaan's right on the page. What goes wrong, how do you fix it, and what habit prevents the slip in a timed test?

    Model answer, Pro. First step and follow-ups

Key takeaways

  • Position from one end + position from the other = total + 1; convert with total − position + 1.
  • Count the people between two others only after both positions are counted from one end.
  • Facing south, a sitter’s left is your right: write the facing above the chairs first.
  • Place the tightest clue first, carry every case, and stop when one row or one answer is left.

References

Related tools

Report a problem with this lesson

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.