Counting with Restrictions and Repetitions

12 soru

Soru 1Soru

An interior designer is arranging a row of 7 decorative wall tiles consisting of 3 identical blue tiles, 2 identical yellow tiles, and 2 identical red tiles. If the 2 red tiles cannot be placed next to each other, how many distinct arrangements of the 7 tiles are possible?

Cevabı ve açıklamayı göster

Cevap: 150

Cevap

The total number of distinct arrangements possible is 150.
To find the total number of distinct arrangements where no two red tiles are adjacent, first calculate the arrangements of the 5 non-restricted tiles (3 blue, 2 yellow), which is 5!3!2!=10\frac{5!}{3!2!} = 10. Placing 5 tiles creates 6 available spaces (including the two ends). Selecting 2 of these 6 spaces for the 2 identical red tiles yields (62)=15\binom{6}{2} = 15 choices. By the Fundamental Counting Principle, the total number of valid arrangements is 10×15=15010 \times 15 = 150.

Adım Adım Çözüm

1
Calculate the number of distinct ways to arrange the non-restricted tiles (3 identical blue and 2 identical yellow).
The number of distinct arrangements of the 5 non-red tiles is 5!3!2!=1206×2=10\frac{5!}{3!2!} = \frac{120}{6 \times 2} = 10.
Arranging all non-restricted tiles first creates the specific positions into which the restricted tiles can be inserted.
2
Determine the number of valid positions for the 2 identical red tiles such that no two are adjacent.
Placing 5 tiles creates 6 available insertion slots (one at each end and four between tiles). Choosing 2 distinct slots out of 6 gives (62)=6×52=15\binom{6}{2} = \frac{6 \times 5}{2} = 15 ways.
Selecting 2 distinct slots ensures that every selected space holds at most one red tile, guaranteeing that no two red tiles are adjacent.
3
Multiply the results from Step 1 and Step 2 using the Fundamental Counting Principle.
10×15=15010 \times 15 = 150.
Each arrangement of non-red tiles can be independently paired with any valid placement of the red tiles.

Anahtar Kavram

Counting arrangements of identical items with non-adjacency restrictions using the slotting method.
Tahmini Süre:1m 30s
Soru 2Soru

How many distinct 4-letter arrangements can be formed by rearranging all of the letters in the word SEES\text{SEES}?

Cevabı ve açıklamayı göster

Cevap: 6

Cevap

6
To calculate the number of unique arrangements for a multiset of letters, compute the total factorial divided by the product of factorials for each repeated letter's frequency. For SEES\text{SEES}, there are 4 total letters with 2 'S's and 2 'E's, resulting in 4!2!2!=244=6\frac{4!}{2!2!} = \frac{24}{4} = 6.

Adım Adım Çözüm

1
Count the total number of letters and identify frequencies of repeated letters.
The word SEES\text{SEES} contains 4 letters in total: two 'S's and two 'E's.
To apply the distinct permutations formula, we need the total count of elements and the counts for each repeated identical element.
2
Calculate the number of distinct arrangements using the formula n!n1!n2!nk!\frac{n!}{n_1! n_2! \dots n_k!}.
\frac{4!}{2! \cdot 2!} = \frac{24}{2 \cdot 2} = 6.
Dividing by 2!2!2! \cdot 2! eliminates duplicate counts arising from swapping indistinguishable identical letters.

Anahtar Kavram

Permutations with Repetition
Soru 3Soru

How many distinct 5-letter code words can be formed by rearranging all of the letters in the word LEVEL\text{LEVEL}?

Cevabı ve açıklamayı göster

Cevap: 3030

Cevap

The total number of distinct 5-letter code words that can be formed is 30.
To calculate the number of unique permutations of a set containing repeated items, divide the factorial of the total number of items by the product of the factorials of the counts of each repeated item. In the word LEVEL\text{LEVEL}, there are 5 letters total, with the letter 'L' appearing 2 times and the letter 'E' appearing 2 times. The calculation is 5!2!×2!=1204=30\frac{5!}{2! \times 2!} = \frac{120}{4} = 30.

Adım Adım Çözüm

1
Identify the total number of letters and the counts of identical letters.
The word LEVEL\text{LEVEL} has 5 total letters, where 'L' appears 2 times and 'E' appears 2 times.
Duplicate elements produce identical arrangements if treated as distinct items.
2
Apply the permutation formula for repeated items: n!n1!×n2!×\frac{n!}{n_1! \times n_2! \times \dots}.
5!2!×2!=1202×2=1204=30\frac{5!}{2! \times 2!} = \frac{120}{2 \times 2} = \frac{120}{4} = 30.
Dividing 5!5! by 2!2! for the repeated 'L's and 2!2! for the repeated 'E's eliminates duplicate arrangements.

Anahtar Kavram

Permutations with Repetition / Indistinguishable Objects
Soru 4Soru

A 6-letter security code is created by arranging all the letters in the word BANANABANANA. How many distinct security codes can be formed such that the two letters NN are not adjacent to each other?

Cevabı ve açıklamayı göster

Cevap: 40

Cevap

40 distinct security codes can be formed such that the two NN's are not adjacent.
To find the number of arrangements where the two NN's are not adjacent, use complementary counting. First, compute total unrestricted permutations of BANANABANANA (1 BB, 3 AA's, 2 NN's), which gives 6!3!×2!=60\frac{6!}{3! \times 2!} = 60. Next, count the forbidden arrangements where the two NN's are together by grouping them into a single block (NN)(NN). Arranging BB, AA, AA, AA, and (NN)(NN) yields 5!3!=20\frac{5!}{3!} = 20. Subtracting forbidden arrangements from total arrangements gives 6020=4060 - 20 = 40.

Adım Adım Çözüm

1
Calculate the total number of distinct arrangements of the letters in BANANABANANA without restrictions.
The word BANANABANANA contains 6 letters in total: 1 BB, 3 AA's, and 2 NN's. The number of distinct permutations is 6!1!×3!×2!=7201×6×2=60\frac{6!}{1! \times 3! \times 2!} = \frac{720}{1 \times 6 \times 2} = 60.
Indistinguishable duplicate letters must be accounted for by dividing the total permutations by the factorial of each letter's count.
2
Calculate the number of arrangements where the two NN's ARE adjacent.
Treat the pair NNNN as a single block. The items to arrange are BB, AA, AA, AA, and (NN)(NN), which gives 5 items with 3 identical AA's. The number of arrangements is 5!1!×3!×1!=1206=20\frac{5!}{1! \times 3! \times 1!} = \frac{120}{6} = 20.
Grouping restricted elements into a single composite element simplifies calculating forbidden configurations.
3
Apply complementary counting to find the number of valid arrangements where the two NN's are not adjacent.
Total valid arrangements = Total arrangements - Adjacent arrangements = 6020=4060 - 20 = 40.
Complementary counting is the most efficient method when calculating non-adjacent placements.

Anahtar Kavram

Counting with Restrictions and Repetitions (Complementary Counting Principle)
Tahmini Süre:1m 30s
Soru 5Soru

How many distinct 6-digit positive integers can be formed using all of the digits 1,1,2,2,3,1, 1, 2, 2, 3, and 44 such that no two identical digits are adjacent to each other?

Cevabı ve açıklamayı göster

Cevap: 84

Cevap

84
To find the number of 6-digit integers where no two identical digits are adjacent, apply complementary counting with the Principle of Inclusion-Exclusion. First, calculate the total distinct arrangements of the digits 1,1,2,2,3,41, 1, 2, 2, 3, 4, which is 6!2!2!=180\frac{6!}{2!2!} = 180. Next, count the forbidden outcomes. Treating the two 1s as a single block gives 5!2!=60\frac{5!}{2!} = 60 arrangements with adjacent 1s. Similarly, treating the two 2s as a single block gives 5!2!=60\frac{5!}{2!} = 60 arrangements with adjacent 2s. Arrangements where both the 1s are adjacent and the 2s are adjacent use two single blocks along with digits 3 and 4, giving 4!=244! = 24 arrangements. By Inclusion-Exclusion, the total number of forbidden arrangements is 60+6024=9660 + 60 - 24 = 96. Subtracting these from the total unrestricted arrangements gives 18096=84180 - 96 = 84.

Adım Adım Çözüm

1
Calculate the total number of unrestricted distinct 6-digit arrangements of the multiset {1, 1, 2, 2, 3, 4}.
Total arrangements = 6!2!×2!=7204=180\frac{6!}{2! \times 2!} = \frac{720}{4} = 180.
Dividing by 2!×2!2! \times 2! accounts for the indistinguishable repeated digits 1 and 2.
2
Define the forbidden events and calculate their individual counts.
Let AA be the set of arrangements with adjacent 1s, and BB be the set of arrangements with adjacent 2s.
For A|A|, treat (11)(11) as a single block: elements are {(11),2,2,3,4}\{(11), 2, 2, 3, 4\}, so A=5!2!=60|A| = \frac{5!}{2!} = 60.
For B|B|, treat (22)(22) as a single block: elements are {1,1,(22),3,4}\{1, 1, (22), 3, 4\}, so B=5!2!=60|B| = \frac{5!}{2!} = 60.
Grouping adjacent identical numbers into a single block simplifies counting restriction violations.
3
Calculate the intersection count AB|A \cap B| where both pairs are adjacent.
Treating both (11)(11) and (22)(22) as single blocks yields elements {(11),(22),3,4}\{(11), (22), 3, 4\}, so AB=4!=24|A \cap B| = 4! = 24.
Arrangements where both pairs of identical digits are adjacent are counted in both AA and BB and must be identified.
4
Apply the Principle of Inclusion-Exclusion to find the total forbidden arrangements and subtract from the total unrestricted arrangements.
AB=A+BAB=60+6024=96|A \cup B| = |A| + |B| - |A \cap B| = 60 + 60 - 24 = 96.
Valid arrangements = 18096=84180 - 96 = 84.
Complementary counting yields the exact number of arrangements where no two identical digits are adjacent.

Anahtar Kavram

Permutations of Multisets with Restrictions via Inclusion-Exclusion
Soru 6Soru

A 7-digit security passcode is to be formed using the digits 1,1,2,2,3,4,1, 1, 2, 2, 3, 4, and 55. How many distinct 7-digit passcodes can be formed such that neither the two 11 s nor the two 22 s are adjacent to each other?

Cevabı ve açıklamayı göster

Cevap: 660

Cevap

660 distinct passcodes can be formed.
To find the number of arrangements where neither identical pair is adjacent, we use complementary counting. First, compute total unrestricted arrangements of the digits 1,1,2,2,3,4,51,1,2,2,3,4,5, which is 7!2!2!=1,260\frac{7!}{2!2!} = 1,260. Next, by treating (11)(11) as a single block, there are 6!2!=360\frac{6!}{2!} = 360 arrangements with adjacent 11 s. Similarly, treating (22)(22) as a single block yields 6!2!=360\frac{6!}{2!} = 360 arrangements with adjacent 22 s. Arrangements where both pairs are adjacent treat (11)(11) and (22)(22) as two single blocks alongside 3,4,53,4,5, giving 5!=1205! = 120 arrangements. Applying Inclusion-Exclusion gives 360+360120=600360 + 360 - 120 = 600 forbidden arrangements. Subtracting from the total gives 1,260600=6601,260 - 600 = 660.

Adım Adım Çözüm

1
Calculate the total number of distinct arrangements without any restrictions.
Total arrangements = 7!2!×2!=5,0404=1,260\frac{7!}{2! \times 2!} = \frac{5,040}{4} = 1,260.
There are 7 digits total, with the digit 1 repeated twice and the digit 2 repeated twice.
2
Calculate the number of arrangements where the two 11 s are adjacent.
N(adjacent 1s)=6!2!=7202=360N(\text{adjacent } 1\text{s}) = \frac{6!}{2!} = \frac{720}{2} = 360.
Treat the pair (11)(11) as a single unit, leaving 6 items: (11),2,2,3,4,5(11), 2, 2, 3, 4, 5 with two identical 22 s.
3
Calculate the number of arrangements where the two 22 s are adjacent.
N(adjacent 2s)=6!2!=7202=360N(\text{adjacent } 2\text{s}) = \frac{6!}{2!} = \frac{720}{2} = 360.
Treat the pair (22)(22) as a single unit, leaving 6 items: 1,1,(22),3,4,51, 1, (22), 3, 4, 5 with two identical 11 s.
4
Calculate the number of arrangements where both the two 11 s and two 22 s are simultaneously adjacent.
N(both adjacent)=5!=120N(\text{both adjacent}) = 5! = 120.
Treat (11)(11) and (22)(22) each as single distinct units, giving 5 distinct items: (11),(22),3,4,5(11), (22), 3, 4, 5.
5
Apply the Principle of Inclusion-Exclusion to find the total restricted count.
Valid passcodes = 1,260(360+360120)=1,260600=6601,260 - (360 + 360 - 120) = 1,260 - 600 = 660.
Subtract the union of forbidden cases from the total arrangements: N(total)[N(1s adj)+N(2s adj)N(both adj)]N(\text{total}) - [N(\text{1s adj}) + N(\text{2s adj}) - N(\text{both adj})].

Anahtar Kavram

Complementary Counting with Inclusion-Exclusion Principle on Permutations of Repeated Elements
Tahmini Süre:2m 0s
Soru 7Soru

An executive board must arrange 7 books side-by-side on a display shelf: 3 identical copies of a Finance textbook, 2 identical copies of an Economics textbook, and 2 distinct novels (Novel A and Novel B). How many distinct linear arrangements of these 7 books are possible such that Novel A and Novel B are not placed adjacent to each other?

Cevabı ve açıklamayı göster

Cevap: 300

Cevap

300
To find the number of distinct arrangements where Novel A and Novel B are not adjacent, use complementary counting. First, compute the total distinct arrangements of the 7 books with identical items: 7! / (3! * 2!) = 420. Next, find the number of arrangements where Novel A and Novel B ARE adjacent by bundling them as one unit [AB], which has 2 internal orderings (AB or BA). Arranging the 6 units ([AB], 3 Finance, 2 Economics) gives 6! / (3! * 2!) = 60 ways. Multiplying by 2 internal orderings gives 120 adjacent arrangements. Subtracting these from the total yields 420 - 120 = 300.

Adım Adım Çözüm

1
Calculate the unrestricted total number of distinct permutations of the 7 books.
420 distinct arrangements
There are 7 total items with 3 identical Finance books and 2 identical Economics books. Using the formula N! / (n1! * n2! ...), we get 7! / (3! * 2!) = 5,040 / 12 = 420.
2
Calculate the number of forbidden arrangements where Novel A and Novel B are adjacent.
120 forbidden arrangements
Treat Novel A and Novel B as a single composite item [AB]. There are 2! = 2 ways to order A and B inside this block (AB or BA). Then, arrange the 6 items ([AB] and the 5 textbooks with repetitions): 6! / (3! * 2!) = 60. Multiplying by 2 internal orderings gives 2 * 60 = 120.
3
Subtract the forbidden (adjacent) arrangements from the total unrestricted arrangements.
300 valid arrangements
By complementary counting, Valid = Total - Forbidden = 420 - 120 = 300.

Anahtar Kavram

Counting permutations with indistinguishable items and non-adjacency restrictions using complementary counting
Tahmini Süre:2m 0s
Soru 8Soru

How many distinct 8-digit positive integers can be formed by rearranging all of the digits 1,1,1,2,2,3,3,1, 1, 1, 2, 2, 3, 3, and 33 such that the resulting integer is even and no two 11 s are adjacent?

Cevabı ve açıklamayı göster

Cevap: 40

Cevap

40
To ensure the 8-digit number is even, the units (8th) digit must be 2. This leaves 7 positions to fill with three 1s, one 2, and three 3s. By arranging the 4 non-1 digits ({2, 3, 3, 3}) first, there are 4! / (1! 3!) = 4 distinct arrangements. Placing 4 digits creates 5 distinct gaps where the 1s can be placed without being adjacent. Choosing 3 gaps out of 5 for the three identical 1s gives C(5, 3) = 10 ways. Thus, the total number of valid integers is 4 * 10 = 40.

Adım Adım Çözüm

1
Fix the last digit to satisfy the even integer restriction
The 8th digit is fixed as 2, leaving 7 positions to fill with the remaining digits {1, 1, 1, 2, 3, 3, 3}.
An integer is even if and only if its units digit is even. The digit 2 is the only even digit in the set.
2
Calculate the arrangements of the non-restricted digits
4! / (1! * 3!) = 4 distinct arrangements.
Arranging the four non-1 digits ({2, 3, 3, 3}) first sets up the framework for placing the restricted 1s.
3
Place the three identical 1s into the gaps using the combination formula
C(5, 3) = 10 distinct gap selections.
The 4 arranged digits create 5 gaps. Selecting 3 distinct gaps ensures no two 1s are adjacent.
4
Multiply the arrangements of non-1 digits by the number of gap choices
4 * 10 = 40.
By the Fundamental Counting Principle, each non-1 arrangement can be combined with any valid gap placement.

Anahtar Kavram

Permutations with Indistinguishable Objects and Non-Adjacency Restrictions (Gap Method)
Tahmini Süre:2m 0s
Soru 9Soru

A bookshelf is to be arranged using 3 identical Mathematics books, 2 identical Physics books, and 1 Chemistry book. In how many distinct ways can all 6 books be arranged in a single row such that the Chemistry book is not adjacent to any Mathematics book?

Cevabı ve açıklamayı göster

Cevap: 12

Cevap

12
The single Chemistry book must not touch any of the 3 Mathematics books. This leaves three mutually exclusive possibilities for the Chemistry book: at the left end preceded by a Physics book (4 ways), at the right end followed by a Physics book (4 ways), or sandwiched between both Physics books as a single block (4 ways). Summing these gives 12 total valid arrangements.

Adım Adım Çözüm

1
Analyze the placement restriction on the Chemistry book
The Chemistry book (C) cannot be placed next to any Mathematics book (M). Thus, C can only be adjacent to Physics books (P) or placed at the boundary of the row touching a P.
Eliminating adjacency to M restricts C to touch only P or the ends of the shelf.
2
Count valid arrangements when C is at the far left (position 1)
The row begins with C-P. The remaining 4 spots must be filled with 3 identical M's and 1 P, yielding 4! / (3! 1!) = 4 distinct ways.
Position 1 has only one neighbor (position 2), which must be P.
3
Count valid arrangements when C is at the far right (position 6)
The row ends with P-C. The remaining 4 spots must be filled with 3 identical M's and 1 P, yielding 4! / (3! 1!) = 4 distinct ways.
Position 6 has only one neighbor (position 5), which must be P.
4
Count valid arrangements when C is in an interior position (positions 2 through 5)
C must be sandwiched between two P's, forming the block (P-C-P). Arranging this single block along with the 3 identical M's (total of 4 items) yields 4! / (3! 1!) = 4 distinct ways.
Any interior placement requires both adjacent neighbors of C to be P.
5
Sum the counts from all mutually exclusive cases
Total valid arrangements = 4 + 4 + 4 = 12.
The three cases cover all possible non-overlapping valid placements for C.

Anahtar Kavram

Counting permutations with identical elements and positional restrictions using case analysis and block formation.
Tahmini Süre:1m 30s
Soru 10Soru

A conference schedule consists of 66 consecutive time slots. The organizers must schedule 33 identical workshops on Artificial Intelligence, 22 identical workshops on Cybersecurity, and 11 keynote address on Data Privacy. If the 22 Cybersecurity workshops cannot be scheduled in consecutive time slots, how many distinct presentation schedules are possible?

Cevabı ve açıklamayı göster

Cevap: 40

Cevap

40 distinct presentation schedules are possible.
The total number of unrestricted ways to arrange the 6 events (3 identical AI, 2 identical Cybersecurity, 1 Data Privacy) is calculated using multiset permutations as 6!3!×2!×1!=60\frac{6!}{3! \times 2! \times 1!} = 60. To find the number of ways where the two Cybersecurity workshops are NOT consecutive, we use complementary counting. By treating the two Cybersecurity workshops as one glued block, we arrange 5 items (3 identical AI, 1 Cybersecurity block, 1 Data Privacy), yielding 5!3!×1!×1!=20\frac{5!}{3! \times 1! \times 1!} = 20 forbidden arrangements. Subtracting the 20 forbidden arrangements from the 60 total arrangements gives 40 valid presentation schedules.

Adım Adım Çözüm

1
Calculate the total number of distinct schedules without restrictions.
Total arrangements = 6!3!×2!×1!=7206×2×1=60\frac{6!}{3! \times 2! \times 1!} = \frac{720}{6 \times 2 \times 1} = 60.
There are 66 total slots with 33 identical AI workshops, 22 identical Cybersecurity workshops, and 11 Data Privacy keynote.
2
Calculate the number of forbidden schedules where the 22 Cybersecurity workshops are in consecutive slots.
Forbidden arrangements = 5!3!×1!×1!=1206=20\frac{5!}{3! \times 1! \times 1!} = \frac{120}{6} = 20.
Treat the 22 identical Cybersecurity workshops as a single combined block. This leaves 55 items to arrange (33 AI, 11 combined Cybersecurity block, 11 Data Privacy).
3
Subtract the forbidden arrangements from the total arrangements using complementary counting.
Valid schedules = 6020=4060 - 20 = 40.
The number of valid restricted arrangements is total arrangements minus restricted consecutive arrangements.

Anahtar Kavram

Counting with Restrictions and Repetitions (Complementary Counting and Permutations of Multisets)
Tahmini Süre:2m 0s
Soru 11Soru

A company creates 5-digit employee identification codes using all of the digits 1,1,2,2,1, 1, 2, 2, and 33. How many distinct 5-digit identification codes can be formed such that the two 22's are not adjacent to each other?

Cevabı ve açıklamayı göster

Cevap: 18

Cevap

18
To find the number of distinct 5-digit identification codes where the two 2's are not adjacent, use complementary counting. First, compute the total distinct arrangements of the digits 1,1,2,2,31, 1, 2, 2, 3, which is 5!2!×2!=30\frac{5!}{2! \times 2!} = 30. Next, find the number of arrangements where the two 2's are adjacent by treating (22)(22) as a single item. Arranging (22),1,1,3(22), 1, 1, 3 yields 4!2!=12\frac{4!}{2!} = 12 arrangements. Subtracting the adjacent arrangements from the total gives 3012=1830 - 12 = 18.

Adım Adım Çözüm

1
Calculate the total number of distinct 5-digit arrangements of the digits 1,1,2,2,31, 1, 2, 2, 3 without any restrictions.
Total arrangements = 5!2!×2!×1!=1204=30\frac{5!}{2! \times 2! \times 1!} = \frac{120}{4} = 30.
When arranging elements with repeated indistinguishable items, divide n!n! by the factorials of the counts of each repeated item.
2
Calculate the number of restricted (forbidden) arrangements where the two 22's are adjacent.
Adjacent arrangements = 4!2!×1!=242=12\frac{4!}{2! \times 1!} = \frac{24}{2} = 12.
Treat the two adjacent 22's as a single block (22)(22). We now arrange 4 items: (22),1,1,3(22), 1, 1, 3, where the digit 11 appears twice.
3
Subtract the forbidden arrangements from the total arrangements using complementary counting.
Non-adjacent arrangements = 3012=1830 - 12 = 18.
Complementary counting gives the number of valid arrangements where the two 22's are not adjacent.

Anahtar Kavram

Permutations with Repeated Indistinguishable Elements and Complementary Counting
Tahmini Süre:1m 30s
Soru 12Soru

A security analyst needs to generate a 6-symbol access code using all of the following characters: A,A,A,B,B,A, A, A, B, B, and CC. How many distinct 6-symbol access codes can be formed such that the two BB's are not adjacent to each other?

Cevabı ve açıklamayı göster

Cevap: 40

Cevap

40 distinct 6-symbol access codes can be formed.
First arrange the four symbols that have no adjacency restrictions (A,A,A,A, A, A, and CC). The number of unique ways to arrange these 4 symbols with 3 identical AA's is 4!3!=4\frac{4!}{3!} = 4. Placing these 4 symbols in a row creates 5 available spaces (one before the first character, three between characters, and one after the last character). To ensure the two BB's are not adjacent, choose 2 distinct spaces out of the 5 for the BB's. The number of ways to select 2 spaces out of 5 is (52)=10\binom{5}{2} = 10. Multiplying the arrangement of base characters by the space selections yields 4×10=404 \times 10 = 40 total valid codes.

Adım Adım Çözüm

1
Arrange the non-restricted characters
There are 4 ways to arrange the remaining characters A,A,A,A, A, A, and CC.
The number of distinct arrangements of 4 characters where 3 are identical is 4!3!×1!=4\frac{4!}{3! \times 1!} = 4.
2
Determine the available slots for the restricted character
Arranging 4 characters creates 5 distinct slots (including the two ends): _ X _ X _ X _ X _.
To ensure no two BB's are adjacent, each BB must occupy a distinct slot around or between the arranged characters.
3
Calculate the combinations of slot positions
There are (52)=10\binom{5}{2} = 10 ways to choose 2 slots for the two identical BB's.
Since the two BB's are identical, order of selection within the slots does not matter.
4
Apply the Fundamental Counting Principle
4×10=404 \times 10 = 40 distinct codes.
Multiply the number of ways to arrange the base characters by the number of ways to place the BB's into the available slots.

Anahtar Kavram

Counting with restrictions using the slotting method for non-adjacent elements