24
Awesome Team
Arnaldo Mandel
Last seen 5 hours ago
Member for 3 years, 2 months, 10 days
Difficulty Advanced
Bad use of boolean. If **B** is a boolean expression, then
**True if B else False**
has the same value as **B**.
More
The algorithm is straightforward, but it keeps too much state. No need for the direction list, you only need the last one; that would require a running counter, also.
More
You are right, and I knew it. The test is there to avoid inserting 0's in the heap. Silly, anyway.
More
Your solution is identical to mine, both were published on the same day (mine is on speedy).
Quite amazing, just the variable names are different (and the way of referring to the last element of a list).
After checking some other solutions, I conclude we really nailed it.
More
You are right, of course. I recently got an invite for the mission, and solved it with code not significantly different from yours. After passing the tests, I stepped back, and realized that I was making an unstated assumption, so I rewrote the code to an ugly one that starts by sorting the data.
More
I have improved it even more. I posted a new solution, named Logical It is a ridiculously simple one-liner:
return num and ( num % 9 or 9 )
More
You're right. I realized it half an hour ago, and posted the new solution.
More
Conceptually simple and natural. The test whether words contains a repetition should be moved to the top, thus avoiding unnecessary work.
More
Interesting use of regexp. There is an error, however: it doesn't detect the case where the last letter of text is repeated.
>>> long_pressed('do','doo')
False
There is a simple fix, though: just add a '+' to the end of pattern.
The test bed for this problem is very lame; it should have
More
Beautiful use of complex numbers to keep track of rotation.
More
Quite interesting: we both have recursive solutions, using @cache, and they look quite different, however both can do [18]*18, but not [20]*20.
Math wins, anyway. Using Kasteleyn's Theorem [30]*30 is a cinch.
More
Your comment on my solution shows that you found out the answer to the title question is yes :-). Of course, the math is the same, the difference, as you pointed out, is the nonlogical use of python's logical operators.
More
I wonder, why list map instead of a simple comprehension?
On the other hand, I liked the single line call to the heap operations.
More
BTW, increasing max_e and max_pi to 3, and even to 4 leads to some surprising results. For instance, try chekio(pi) with those values at least 3.
More
This is a silly use of lambda. Writing one line with a def and a second line with a return ought to count as a one-liner for bragging rights, but is a cleaner code.
More
Very nice idea, however it fails on 'aabaab'; I understand that it should return the whole string in this case.
I wonder how many solutions will fail this test.
More