Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How can we divide the ideas into groups to make it easier to find valid pairs?
Group ideas that share the same suffix (all characters except the first) together and notice that a pair of ideas from the same group is invalid. What about pairs of ideas from different groups?
The first letter of the idea in the first group must not be the first letter of an idea in the second group and vice versa.
We can efficiently count the valid pairings for an idea if we already know how many ideas starting with a letter x are within a group that does not contain any ideas with starting letter y for all letters x and y.