100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

How to Solve Permutation with Repetition Problems

Learn permutation with repetition (n^r) versus standard nPr, with a worked PIN-code example and aptitude practice questions with answers.

mediumQ166 of 225 in Aptitude Est. time: 5 minsLast updated:
Open Code Lab

Expected Interview Answer

When items may repeat and each position is filled independently from the same pool of n choices, the count of ordered arrangements of length r is simply n^r, not n!/(n−r)!, because nothing is removed from the pool after each pick.

Standard permutation formulas (nPr) assume each chosen item is unavailable for later positions, which only holds when items cannot repeat. The moment repetition is allowed — PIN digits, license plates, or password characters — every position independently has all n options again, so the counts multiply straight across: n × n × n... r times, giving n^r. A related but distinct case is arranging a fixed multiset with repeated identical items (e.g., the letters of "BANANA"), which instead divides n! by the factorial of each repeat count to remove indistinguishable orderings. Always ask first whether the pool refreshes after each pick (repetition allowed, use n^r) or whether specific items themselves repeat within one fixed arrangement (use n!/(repeat factorials)).

  • n^r handles any “choose with replacement, order matters” scenario instantly
  • Distinguishes cleanly from nPr, which assumes no repetition
  • Extends naturally to counting passwords, codes, and repeated-letter words

AI Mentor Explanation

A commentator predicting the outcome (W for wicket, R for run, D for dot ball) of each of 3 consecutive deliveries has 3 independent slots, each with the same 3 possible outcomes, since any delivery can repeat any outcome. The total number of distinct 3-ball outcome sequences is 3×3×3 = 27, not a shrinking-pool permutation, because nothing about ball one restricts what ball two can be. This is exactly permutation with repetition: n^r where n is the pool size and r is the sequence length, reused at every position.

Worked example

Step-by-Step Explanation

  1. Step 1

    Confirm repetition is allowed

    Check whether the same item can be chosen again at a later position.

  2. Step 2

    Identify pool size n and length r

    n is the number of available choices per position; r is the sequence length.

  3. Step 3

    Apply n^r

    Multiply n by itself r times since every position independently has all n options.

  4. Step 4

    Contrast with nPr

    If repetition were forbidden, the pool would shrink by one after each pick, giving n!/(n−r)! instead.

What Interviewer Expects

  • Correctly identifying that repetition is allowed before choosing a formula
  • Applying n^r rather than nPr when items can repeat
  • Distinguishing “repetition allowed” from “arranging a fixed multiset with repeated letters”
  • A correctly worked numeric example, such as a PIN or password count

Common Mistakes

  • Using nPr (a shrinking-pool formula) when repetition is actually allowed
  • Confusing permutation-with-repetition (n^r) with multiset-arrangement (n!/repeat factorials)
  • Forgetting that position order still matters even though items repeat
  • Miscounting r, the number of positions, versus n, the pool size

Best Answer (HR Friendly)

If items can repeat and each position is filled independently, the count is simply n to the power r — the pool size raised to the number of positions — because every slot always has the full set of options available again. This is different from the standard permutation formula, which assumes each choice removes an item from what is left. A 4-digit PIN using digits 0 through 9 with repeats allowed has 10 to the 4th power possible codes, which is ten thousand.

Follow-up Questions

  • How would the count change if the first digit of the PIN could not be zero?
  • How do you count arrangements of a word with repeated letters, like "BANANA"?
  • How does permutation with repetition differ from combinations with repetition?
  • How would you count passwords requiring at least one repeated character?

MCQ Practice

1. How many 3-letter codes can be formed from the 26 letters of the alphabet if letters may repeat?

26^3 = 17576, since each of the 3 positions independently has all 26 letters available.

2. A 4-digit PIN uses digits 0-9 and digits may repeat. How many distinct PINs are possible?

10^4 = 10000, since each digit position has 10 independent choices.

3. Which formula applies when arranging r items chosen with repetition from a pool of n?

With repetition allowed, each of the r positions independently has n choices, giving n^r.

Flash Cards

Formula for permutation with repetition?n^r — n choices raised to the power of r positions.

When does n^r apply instead of nPr?When the same item can be reused at more than one position.

Does order still matter with repetition?Yes — n^r is still an ordered count, just without a shrinking pool.

4-digit PIN with digits 0-9, repeats allowed?10^4 = 10000 possible PINs.

1 / 4

Continue Learning