36
nickie
14 32 45
7469/ 8195
Last seen 11 months ago
Member for 10 years, 7 months, 24 days
Difficulty Normal
Best reviews / Newest reviews
First-ignalion 1 1
My initial solution is a functional one: the recursive function returns a part of the flattened list (either directly or lazily, using generators). You preferred an imperative version. But this solution builds too many lists, one for each nested level, and then concatenates them. If you want to a More
First-veil 1 1
Sorry, this is not my type of clear. For example, why would you prefer your line 7: for (x1,y1) in [(x1,y1) for x1 in range(3) for y1 in range(3)]: over: for x1 in range(3): for y1 in range(3): or better: for x1, y1 in itertools.product(range(3), repeat=2) More
First-panaro32 1 1
The difference between our one-liners is memory consumption. Disregarding that, I like yours more than mine... More
Union - find-ale1ster 1 1
Well, a union-find indeed, but not like the one they teach... :-) And you could have stopped searching sooner by something like: while last or target in cc: More
First-bunnychai 1 1
Factorization is not the way to approach this: >>> checkio(2**127) 2888888888888888888888888888888888888888888 >>> checkio(2**127-1) ... This will never finish, as 2**127-1 is a Mersenne prime number and prime_factors will have to go up to its square root. More
First-melpon 1 2
A little shorter and arguably more readable: checkio=lambda v:['Fizz Buzz','Buzz','Fizz',str(v)][(v%3!=0)+2*(v%5!=0)] More
First-htamas 1 1
Well done. I think we have the same solution: solving for all configurations, then answering. I think you're using an exhaustive search, whereas I'm using minmax with alpha/beta pruning. Also, I'm not sure how your solution works if the ghost does not do what you expect in case of ties. More
Cycle detection-DiZ 1
A brilliantly short solution (a bit obfuscated here, for obvious reasons). Horrible, from a graph theoretic perspective, but still brilliantly coded. An ordinary brute force solution would be exponential in the number of vertices (rings). This solution is exponential in the number of edges (links) More
First-StanislavOsovskyy 1
Nice, not much to say. Notice that "number%100%10" is a redundancy: "number%10" is equivalent. More
First-Natsu- 1
I wouldn't write it like this but I like it; straight to the point. Notice that you don't need "combinaisons" at all and, at the same time, you can return immediately when you recognize a winner. I'm rewriting lines 21 to 35: for positions in checkPositions: More
First-Gennady 1
A nice one, although I don't like eval too much... More
merge_sort-ciel 1
Well done. I have a slightly slower version (more Pythonic in the merging phase) with comments and longer variable names. And (answering to acman), yes, this is faster than the obvious solution by exactly the same amount that mergesort is faster than bubblesort. If you think of it, counting inver More
First-Sim0000 1 1
That's what I thought I should do when I started this task, and it would have saved me a few hours of struggling to understand the exceptions. But if I had gone this way, I'd have precomputed the whole answer... More
code<FONT-veky 1 1
Well done, although I'm not quite sure I understand how this is shorter than FONT. Do you mean, with the indentation in the answer template? More
sum zip-veky 1 1
I thought I had a puzzle solution... :-( More
First-bunnychai 1
Nice. However, you're making no effort to find the solution with a small number of guesses; in fact you do quite the opposite by considering the divisors in ascending order... A small divisor classifies numbers in fewer classes than a larger divisor. Using range(10, 1, -1) instead of range(2, 11) More
First-cbrunet 1 1
I'm sorry to find out that your solution needs more than 7 rounds for some test cases. Exhaustive testing gives: Failed: 2637 ['0123 0B2C', '9876 0B2C', '1067 1B1C', '1638 2B0C', '1692 1B1C', '1739 1B1C', '1908 0B0C'] Failed: 3467 ['0123 0B1C', '9876 0B2C', '1467 3B0C', '1468 More
General & pessimistic-nickie 1
In comparison with other simpler solutions, this one takes the pessimistic approach. It tries to find the candidate that, in the worst case, will eliminate the most possible cells in the next round. I didn't bother defining and using global variables (checked and seek); I should have, if this is More
First-Juge_Ti 1 1
This uses the fact that in an arithmetic system with base k, a number is divisible by k-1 if and only if the sum of its digits is divisible by k-1 (cf. base 10 and the divisibility rule for 9). Instead of your function f(c), you could have used equivalently: int(c, 36) More
First-Uladzimir 1 1
Well done. Using [itertools.permutations](http://docs.python.org/3/library/itertools.html#itertools.permutations) you don't need the check for i != j... More
1 2
3
4 5 6 7 8 9 10