GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • Fundamentals & OOPs
  • Data structures and algorithms
  • Aptitude
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 27 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
AptitudeQuantitative aptitude · Numbers and Counting

Permutations and Combinations

Counting arrangements and selections without listing them: the multiplication principle, nPr and nCr, restrictions, round tables, committees and words with repeated letters.

6 min read 45 questions
Practice questions
ABC3!

On this page

1/9
  1. 011. What counting questions ask
  2. 022. Factorials, nPr and nCr
  3. 033. Arrangements in a row: words and seats
  4. 044. Numbers from digits
  5. 055. Circular arrangements
  6. 066. Selections: committees, pairs and routes
  7. 077. Shortcuts and traps
  8. 088. Revision sheet
  9. 09Practice
Back to top

1. What counting questions ask

Permutations and combinations is the art of counting without listing. A question describes a task (seat people, form a number, pick a team) and asks in how many ways it can be done. Tests like these questions because one sentence in the wording changes the method, and probability depends on the same skills.

Multiplication principle. If a task has several steps, and the number of choices at each step does not depend on what was chosen before, multiply the choices. Addition principle. If the task can be done in one way *or* another, and the cases do not overlap, add them. In short: AND means multiply, OR means add.

One box per decision4shirts3trousers2shoes
4 shirts AND 3 trousers AND 2 pairs of shoes: 4 × 3 × 2 = 24 outfits

Worked example. A 4-digit ATM PIN can use any digit in each place, so there are 10 × 10 × 10 × 10 = 10,000 PINs. If no digit may repeat, the choices shrink at each step: 10 × 9 × 8 × 7 = 5,040.

2. Factorials, nPr and nCr

n! (n factorial) = n × (n − 1) × … × 2 × 1 is the number of ways to put n different things in a row. 0! = 1.

SymbolCountsFormulaExample
n!orders of n different thingsn × (n − 1) × … × 15! = 120
nPrordered choices of r from n (arrangements)n! ÷ (n − r)!6P2 = 6 × 5 = 30
nCrunordered choices of r from n (selections)n! ÷ (r! × (n − r)!)6C2 = (6 × 5) ÷ (2 × 1) = 15
n^rr places, n choices each, repeats allowedn × n × … (r times)5³ = 125

Does order matter? That one question picks the formula. Choosing a captain and a vice-captain from 6 players is an arrangement (who gets which job matters): 30 ways. Choosing 2 players to go and fetch the kit is a selection: 15 ways. Each selection of r things can be ordered in r! ways, so nPr = nCr × r!.

Useful facts: nCr = nC(n − r), so 10C7 = 10C3 = 120. nC0 = nCn = 1. nC1 = n. nC2 = n(n − 1) ÷ 2.

3. Arrangements in a row: words and seats

Repeated letters. If some items are identical, divide by the factorial of each repeat count. BANANA has 6 letters with A three times and N twice: 6! ÷ (3! × 2!) = 720 ÷ 12 = 60 arrangements.

Things that must stay together: glue them. To arrange the letters of PLANET with the vowels A and E together, treat AE as one block. The block and 4 consonants make 5 items: 5! = 120 orders, and the block can read AE or EA (× 2!). Answer: 240.

PLANETGlue A and E: 5 items to order, then 2 orders inside the block
The glue method: 5! × 2! = 240

Things that must stay apart. For two items, subtract: total − together = 720 − 240 = 480. For three or more, use the gap method: arrange the others first, then drop the restricted items into different gaps. Check with PLANET: the 4 consonants can be ordered in 4! = 24 ways and leave 5 gaps; A and E take two different gaps in 5 × 4 = 20 ways; 24 × 20 = 480, the same answer.

Rank of a word. To find where a word sits in dictionary order, go letter by letter and count the words that start with a smaller letter at that place: (number of smaller unused letters) × (letters left)!. Add 1 at the end.

4. Numbers from digits

Draw one box per place and write the number of choices in each. Fill the most restricted place first: the units place for even, odd or "divisible by 5" numbers, and remember that 0 cannot go in the first place.

Even 3-digit numbers ending in 2 or 4 (digits 0–4, no repeats)2hundreds3tens3unitsFill units first (2), then hundreds (3), then tens (3)
Zero needs its own case: numbers ending in 0 are counted separately

Worked example. How many 3-digit even numbers can be made from 0, 1, 2, 3, 4 with no repeats? Ending in 0: the other two places take 4 × 3 = 12. Ending in 2 or 4 (2 ways): the hundreds place has 3 choices (not 0, not the units digit) and the tens place 3. That is 2 × 3 × 3 = 18. Total 12 + 18 = 30.

5. Circular arrangements

Around a round table there is no first seat, so turning everyone one place gives the same seating. Fix one person to remove the rotations and arrange the rest: n people can sit in (n − 1)! ways. Six people: 5! = 120.

TableABCDEF
Fix A, then arrange the other five: 5! = 120 seatings
  • Two particular people together: glue them, giving (n − 2)! × 2.
  • Men and women alternating (n of each): seat the men in (n − 1)! ways, then the women fill the gaps in n! ways.
  • Necklaces and garlands can also be flipped over, so divide once more by 2: (n − 1)! ÷ 2.

6. Selections: committees, pairs and routes

Committees. Choose from each group separately and multiply. Two men from 5 and two women from 4: 5C2 × 4C2 = 10 × 6 = 60.

"At least one". Count everything and subtract the unwanted case. A committee of 4 from 5 men and 4 women with at least one woman: 9C4 − 5C4 (no women) = 126 − 5 = 121. For "at least 2" or more, add the separate cases (exactly 2, exactly 3, …). Never "pick the required ones first and then anyone": that counts the same committee more than once.

Pairs. Handshakes among n people, matches in a round-robin league and lines through n points are all nC2. A polygon with n sides has nC2 − n = n(n − 3) ÷ 2 diagonals. Triangles from n points with no three in a line: nC3.

AB3 blocks east, 2 blocks north
Every shortest route from A to B is a string of 3 E moves and 2 N moves

Routes on a grid. A shortest route that goes 3 blocks east and 2 north is a word made of EEENN. Choose which 2 of the 5 moves are N: 5C2 = 10 routes. Through a given junction: multiply the routes before it by the routes after it.

Identical items. n identical things shared among k people with everyone getting at least one: (n − 1)C(k − 1). If someone may get nothing: (n + k − 1)C(k − 1).

7. Shortcuts and traps

  • Arrangement or selection? "Arrange, seat, rank, form a number or word" means order matters. "Choose, select, form a committee or team" means it does not.
  • Leading zero. A number cannot start with 0. Split into cases when 0 is among the digits and the last digit is restricted.
  • Repeats allowed or not? Read it every time. With repeats use n^r, without use nPr.
  • "Not together" for three or more is not total minus "all together". Use gaps.
  • Alternating in a row with equal numbers has two patterns (× 2); with one extra of a kind there is only one pattern.
  • Circular: only one factor of n is lost. Seat one group in (n − 1)! ways; everyone after that is placed relative to them with ordinary factorials.
  • Check with a tiny case. If the method gives the right count for 3 or 4 items that you can list by hand, trust it for 8.

8. Revision sheet

SituationCount
n different things in a rown!
r places filled from n, no repeatsnPr = n(n − 1)… (r factors)
r places, n choices each, repeats allowedn^r
Choose r from nnCr
n letters with repeats p, q, …n! ÷ (p! × q! × …)
k particular items together (n items in all)(n − k + 1)! × k!
No two of k items together (m others)m! × (m + 1)Pk
n people round a table(n − 1)!
Handshakes / matches among nnC2
Diagonals of an n-sided polygonn(n − 3) ÷ 2
Shortest grid routes, a east and b north(a + b)Ca
n identical items to k people, each at least 1(n − 1)C(k − 1)

Three questions settle most problems: Does order matter? Are repeats allowed? Is there a restriction to deal with first?

Practice

45 questions in 3 sets. Every answer comes with its explanation, and each question you get right earns XP.

  • Easy · 15
  • Medium · 15
  • Hard · 15
Start practising
PreviousNumber SystemNextProbability
Log inStart free