Is the answer 60?

The Gateway to Computer Science Excellence

+4 votes

You could do it this way:

The number of length one strings (L1) = 2.

The number of length two strings (L2) = 2.

These can be trivially found out.

Now for L3, we fix the first and last positions as a_a or b_b. Now, in the blank there has to be a string of length 1, for which we have two options. Therefore, the total number of strings are (a_a)*2 + (b_b)*2 = 4.

We can extend this logic for all the further substrings.

L4 = a__a + b__b where the blank will contain strings of length 2.

L5 = a___a + b___b where the blank will contain strings of length 3.

L6 = a____a + b____b where the blank will contain strings of length 4 and so on.

When you add all these, you should get 60.

The number of length one strings (L1) = 2.

The number of length two strings (L2) = 2.

These can be trivially found out.

Now for L3, we fix the first and last positions as a_a or b_b. Now, in the blank there has to be a string of length 1, for which we have two options. Therefore, the total number of strings are (a_a)*2 + (b_b)*2 = 4.

We can extend this logic for all the further substrings.

L4 = a__a + b__b where the blank will contain strings of length 2.

L5 = a___a + b___b where the blank will contain strings of length 3.

L6 = a____a + b____b where the blank will contain strings of length 4 and so on.

When you add all these, you should get 60.

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.6k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.5k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,833 questions

57,702 answers

199,407 comments

107,503 users