Counting Flashcards

1
Q

Number of substrings in a string

A
For first char it will be n,
For second char it will be n - 1,
For third char it will be n - 2,
.
.
.
1 - String with all chars, actual string
So it is addition of all n + (n - 1) + (n - 2) + ... + 1 = n (n+1) / 2
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In world cup there are 10 teams, all teams will play others. How many matches will be there?

A

10 C 2 = 10! / (8! * 2!) = 90 / 2 = 45

How well did you know this?
1
Not at all
2
3
4
5
Perfectly