Assume strings contain ONLY the letters: a, b.
How many bit strings of length 8 either start with bbb or end with aa ?
n(start with bbb) = n(fix first 3 as bbb, combinations for remaining 5 letters)
= (no. of option for each letter)^5
= 2^5
= 32
n(end with aa) = n(fix last 2 as aa, combinations for remaining 6 letters)
= (no. of option for each letter)^6
= 2^6
= 64
n(start with bbb and end with aa)
= n(fix last 2 as aa, first 3 as bbb, combinations for remaining 3 letters)
= (no. of option for each letter)^3
= 2^3
= 8
n(start with bbb or end with aa) = n(start with bbb) + n(end with aa) - n(start with bbb and end with aa)
{subtracting n(start with bbb and end with aa) since it is counted twice as it is common in both cases}
= 32+64-8
= 88 (answer)
(please UPVOTE)
Get Answers For Free
Most questions answered within 1 hours.