Computer Sciences > GATE 2025 SET-1 > Combinatorics
Let S be the set of all ternary strings defined over the alphabet {a, b, c}. Consider all strings in S that contain at least one occurrence of two consecutive symbols, that is, "aa", "bb" or "cc". The number of such strings of length 5 that are possible is ______ (Answer in integer)

Correct : 195

Correct Answer:
195

Explanation:
To find the number of ternary strings of length 5 that contain at least one occurrence of two consecutive identical symbols ("aa", "bb", or "cc"), it is most efficient to use the principle of complementary counting.

We will calculate the total number of possible ternary strings of length 5 and subtract the number of strings that do not contain any consecutive identical symbols.

1. Calculate Total Ternary Strings of Length 5:
Since the alphabet is {a, b, c}, there are 3 choices for each of the 5 positions.
    Total Strings = 3 × 3 × 3 × 3 × 3 = 35 = 243

2. Calculate Strings with NO Consecutive Identical Symbols:
Let's choose characters position by position ensuring no adjacent characters match:
Position 1: Any of the 3 characters ({a, b, c}) can be chosen → 3 choices
Position 2: Must be different from Position 1 → 2 choices
Position 3: Must be different from Position 2 → 2 choices
Position 4: Must be different from Position 3 → 2 choices
Position 5: Must be different from Position 4 → 2 choices

    Invalid Strings = 3 × 2 × 2 × 2 × 2 = 3 × 24 = 48

3. Subtract to Find Valid Strings:
Subtract the invalid combinations from the total sample space:
    Valid Strings = Total Strings - Invalid Strings
    Valid Strings = 243 - 48 = 195

Similar Questions

A pennant is a sequence of numbers, each number being 1 or 2. An n-pennant is a sequence of numbers with sum equal to n. For example, (1, 1, 2) is a 4-pennant....
#1220 NAT
Consider 4 × 4 matrices with their elements from {𝟎, 𝟏}. The number of such matrices with even number of 𝟏s in every row and every column is
#1491 MCQ
A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From...
#1 MCQ

Related Topics

No tags found

Unique Visitor Count

Total Unique Visitors

Loading......