[Community Puzzle] Drug Interactions

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Westicles,validated by @romain.wg,@abbecool and @Miki09.
If you have any issues, feel free to ping them.

Is ‘A’ and ‘a’ regarded as “common”? It is undefined.

1 Like

There was the same question in contribution, without answer.

Yes, ‘a’ and ‘A’ are indeed the same letter. Surely you knew :slight_smile:

Edit: Joking aside, I clarified it in the text.

Surely you knew it should have been written.


Maybe it is a language thing? In English it is very clear as originally written… they are the same letter, but different characters.

If people ask for it, here and in the contribution page, it’s because it’s not clear.
It’s not because it’s clear for you that it’s clear for anybody else. You don’t publish a puzzle only for you.

Moreover, I don’t know if a common repeated letter is counted only once or not. It’s not in the statement.
One last thing: it does not seem to me that it’s a medium puzzle.

Maybe you kept your tab open and didn’t see it but the statement has been updated yesterday evening about repeating letters and now it’s fine.

I think it would be medium without a doubt with a slightly smaller n but with the current n I couldn’t complete it in python with a basic algo, I had to use additionnal tricks to pass testcase 5 (sorting and early breaks).
So it makes it medium++ for “slow” languages.


I solve it with python3 and c++ with the same basic approach, without sorting or early breaks.
But I agree, it’s between medium and hard problem.

1 Like

I you don’t mind sharing your solution - not here ofc but in the dedicated section, I’ll take a look at it.
Edit : I found a faster solution than my previous one that uses set intersection, it might be what you were thinking of. It doesn’t require sorting and early break indeed and is quite short.

1 Like

Done, I used only one simple recursive function :slightly_smiling_face:

1 Like

Nice! It is good to see people mostly liked this puzzle, except for the two people who really really hated it :stuck_out_tongue:

It’s not a question of hate but a question of clarity.