36
Nikos Papaspyrou
https://www.softlab.ntua.gr/~nickie/
Last seen 10 months ago
Member for 10 years, 6 months, 28 days
Difficulty Normal
Once more, well done! It was obvious that an O(N) dynamic programming solution was possible, but it turns out that a closed formula is not too much to ask...
I'll try to explain how this works; as the markdown syntax does not seem to allow inline images for mathematics (unless I upload them exte
More
Google translate may not know it, but in Greek you usually need an article before nouns, my friend.
if language == "Ελληνική": return "Αγαπώ την Python!"
And, although I cannot be sure, I doubt that the Esperanto translation is accurate. Could it be "Mi amas Python!" ?
More
An explanation of this solution is in the attached PDF file. The motivation for writing this came when I tried to decrypt [Veky's one-liner solution](http://www.checkio.org/mission/box-probability/publications/veky/python-3/complement/) (as it typically happens) and my explanation first appeared th
More
Explanation:
1. **remove** removes the first occurrence of 'x' from 's', assuming that there exists one.
2. **best** returns the minimum element in list 'options', skipping all None elements. If no elements other than None exist, it returns None.
3. **search** finds the best possible inner
More
For anyone interested in an explanation of this solution, see [my comment](http://www.checkio.org/mission/minesweeper/publications/Juge_Ti/python-3/first/#comment-outer-8654) in Juge_Ti's similar solution.
I'm adding some code (Python 3) that could be useful if you want to test your solutions.
More
Some of what I'll say has already been discussed, but let me add my two cents. There are several ways to solve this problem, without using the forbidden words. These include:
1. The hacker's way: use **eval** to circumvent the restrictions so as to be able to use **sum**.
2. The trickster's
More
Oh my... It turns out you can make it even shorter if you try to take out the cryptic bitwise stuff:
import re
checkio=lambda t:sum(len(set((c in 'AEIOUY')==i%2
for i,c in enumerat
More
I believe we have the same algorithm with a few rather technical differences, affecting performance (I guess your solution is faster) and readability (I guess mine is more clear). The only algorithmically non-trivial difference is your "if" statement in line 9, which handles the case of an unknown
More
Here's a decryption of veky's solution, for anyone interested to study it:
from itertools import permutations
def checkio(chips):
return max([B+E+H+K+N+Q
for a,b,c,d,e,f in permutations(chips)
for A,B,C in permutations(a)
More
I think that using a second lambda does not make it shorter. Only a bit more puzzling...
More
Alright, same idea. I missed the "'www' in" part, which is much nicer than my "find". You missed how to avoid the "if...else" part. Well done! Combining our puzzles, we get:
checkio=lambda t:'T'*3in"".join(str(w.isalpha())[0]for w in t.split())
More
I think this solution could pass as "clear". The loop in line 38 counts each row that it finds and assigns row IDs to all points that lie on them. Each point can be assigned many IDs, as it can lie on many rows. When a new row is found, line 42 checks whether the two points defining it have ever
More
There are two things I don't particularly like in your solution (for all that my opinion is worth, of course). The first is that you've changed the default value for the positional argument (this is invisible to the function's user but was written differently in the task description). More importa
More
Haven't I upvoted this one before? Let me see, what had I given it? Ah, it was a +2. Now it's going to be a +3 because of the palindrome and the provocative comment which bring it to 138 characters, if I counted right... I would have been tempted two to add two more characters and make it 140...
More
I suspect that this will be the top voted solution, so my two cents will go here.
For this problem I can see three types of solutions --- plus Veky who in general is a whole new type all by himself but, for this problem, I think he falls in the third type (although I can't pretend I understand mu
More
My solution is based on [Church numerals](http://en.wikipedia.org/wiki/Church_encoding). Functions c and u convert from Python's integer numbers to Church numerals and back; c is written in a funny way. Function p is the standard implementation of addition in Church encoding. Finally, checkio cal
More
I think we've reached the point where Python ends and Javascript begins... Creative, yes it is. We always meant it in the sense that [Webster](http://www.merriam-webster.com/dictionary/creative) phrases as "done in an unusual and often dishonest way".
More
This requires O(N^2) time and has to go all the way. Sorry, but I don't think it should be the top voted solution.
More
So, I was wondering why [Wolfram MathWorld](http://mathworld.wolfram.com/Spheroid.html) was giving a different formula for the spheroid's surface and why it didn't work when I tried it...
They used complex numbers! Math vs. "look it up": 1-0. :-)
More