Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Agreed. For what it's worth, my solution worked fine well past n = 100000 k = 5.
Legitimate question. Doing this for the key instead:
key='T_T :( :| :) :D'.split().index
This still isn't quadratic time because the number of emotions can't grow. It's slower, but just by n times the difference in comparison time?
2 lines? Are you losing your touch?
My bad, this is the one that accounts for the 2 pair cases and such.
What cha think?
I understand the scoring function, it was just unclear if there was any intention to account for special cases in hands like 2 Pair where the count of the value is important.
The addition you made to sort on count --> value before comparing looks like the right solution. :)
It also fails on 2 pair cases like this one: "AC AS 2H 2C KH", "AD AH 2D 3S 3C"
There's no logic to account for the Aces + 2s losing to Aces + 3s.
This answer just games the tests hard, pure and simple.
This answer should not be valid because it doesn't account for Ace low straights (Ace, 2, 3, 4, 5). There are only 38 unique possible hands in the "random" tests, which never actually include Ace low straights.
Example failure case: "AD 2H 3H 4H 5H", "KD KS TS QS JS"
I am also highly suspicious of that score function...