Nov. 23, 2017, 1:46 p.m. |
+ 1 |
for Comment
gyahun_dash: ### Appendix (but longer than code) ---- First, let jars be small and large: small, large = min(jars...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
veky: That's funny, because it really is very simple. ;-] You just have to ask: am I rebinding the name, o...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
veky: Bresenham is cool, but overkill. You just need to see if a line intersects any of the four edges. Th...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
veky: Everything is different, even things that seem the same. This is the Other Side of the Looking Glass...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
Cjkjvfnby: I think yes. I forgot to change list to queue. And this is not best solution :( I should not solve a...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
veky: Ah, ok then. I thought you teach C because you have that low-level mindset: int flags, while loops, ...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
nickie: Haven't I upvoted this one before? Let me see, what had I given it? Ah, it was a +2. Now it's going ...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
nickie: OK, here's the story of this solution and why it ended up being "uncategorized", superseded by [my o...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
shellaylee: Consider the Fibonacci-like sequence from positive perspective, i.e. a[i]. The base rule is: a[i] = ...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
coells: To be more precise, I think you're laptop fell of the table and ASCII letters on-screen somehow asse...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
Cjkjvfnby: Just crazy idea: You can make test what will check diff of code and block if code has more insertion...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
macfreek: I just might have gotten a bit carried away here in my desire to solve this in linear time instead o...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
jcg: Nice new kind of task. I have a solution which solves the task, but parse_array("[1], [2,3]") return...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
Sim0000: Thank you for nice mission. New try is interesting, and I have fun it. By the way, I feel we need on...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
Cjkjvfnby: >For example: n = "18". As we can see k should be greater than 8. If k == 9, then n = 20 in the deci...
|
Nov. 23, 2017, 1:45 p.m. |
+ 1 |
for Comment
coells: Good news everyone! The very first solution I have no idea why it works... -- Hubert J. Farnsworth
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
macfreek: I fully agree with Positronic Llama and nickle. I'm even going so far to say that this is a task tha...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
macfreek: Trace what happens if a number is divisible by 15. The statement in line 5 would be True, and in lin...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
macfreek: Bryukh already mentioned [PEP 8](http://legacy.python.org/dev/peps/pep-0008/). But that's mostly abo...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
macfreek: If you are already proficient with Python 2, read http://docs.python.org/3/whatsnew/3.0.html]. Even ...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
macfreek: Also, don't forget about https://docs.python.org/3/tutorial/.
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
coells: :D I said I was using notepad, not I was crazy. It's just a brain training. Take any Home task and g...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
coells: No, I don't think recursion is always faster since stack de/alloc can be cheaper than heap allocs (n...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
coells: I wouldn't need one since it's just math. However, I understand solution is best proof, so just for ...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
coells: As a fair measurement I'd propose a reference set of algorithms. Simply prepare several solutions fr...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
bunnychai: for i, for j, 2 loops, about 0.5 * n^2, precondition is 0 < n < 10^5, so may require 0.5 * 10^10, wh...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
coells: Nasty side-effects, right? I had to use memoization to overcome recursion-depth limitations. Even th...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
nickie: You are right but I'm counting on the ability of a good compiler to detect this and automatically re...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
Cjkjvfnby: What is stronger: intersection or 'is considered wrong because it contains nested tags.'
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
veky: You can. You just have to write if not decimals: number = int(number) before. :-D
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
Cjkjvfnby: Why you don't make error messages for modules from standard library? **"This module is not allowed o...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
bukebuer: Thank you. There are so many lines can be optimized. I think I would reconstruct these codes once I ...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
veky: Of course, by first "it" I meant the badge, not the task. :-D (By second "it" I meant the task.:)
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
veky: > For example: N=100 => t=0.001; N=1000 => t=0.11; N=2000 => t=0.43, so the result looks like O(N^2)...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
bunnychai: len(list) -> len(data)
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
moazaaa: Oh I see, that's why the result seemed to me to be random, in fact it was not. Later I read somewher...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
veky: I don't see what is counter-intuitive there. Imagine you have the CSS SPAN{ border: 1px solid orange...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
ciel: Actually I used my pencil quite a lot. Perhaps the author thought this type of equation easily thoug...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
bbwolfa: I guess it's a C++ habit that announce the return value when enter the function.
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
Cjkjvfnby: > I wanna write a clear code with own class because it is not intuitive that list is triangle. It is...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
veky: re is obviously an overkill here. With the necessary escaping it is even longer than ordinary index ...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
nickie: Which function is not pure and which argument is being mutated? I think you're wrong here. If you're...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
ciel: You must return [0,0,0] whenever data[0]+data[1]<=data[2] (not forming triangle)
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
natsuki: My first solution failed the following cases, but my second solution passed. assert check_solution(c...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
Eldin: and nevermind. I excluded 999 in my code wich gave it an unchanging while-loop :D Passed now so just...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
htamas: Because if you used it, it _would be_ too magic. Or at least [more magic](http://catb.org/jargon/htm...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
veky: Yes, that's a nice trick. However, if _I_ used it, then people would claim it's too magic. :-D :-]
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
htamas: Yes, I could have written for i in range(len(ranges)): if painted(ranges[:i+1]) >= num: return i+1 i...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
ArbitraryHubris: You asked this a long time ago but I'm going to post a reply for others finding this conversation. I...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
nickie: Right. This stupid concatenation takes O(N^2). You can concatenate with a for loop in linear time (a...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
nickie: This solution is different from all "Clear" solutions I've seen so far in that it does not try to si...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
hanpari: I would like to express my deep admiration for the people who are making graphics for checkio. This ...
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
guido: Well, then this is the best we can do. Fine!
|
Nov. 23, 2017, 1:44 p.m. |
+ 1 |
for Comment
3mr3bdoh: wohoo, thanks a lot :D. sorry, I am still learning and sometimes I am amazed by how complicated I ma...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
Cjkjvfnby: You can sort a,b,c at the begining. This will simplify check and you will not need sort at the end. ...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
PositronicLlama: TL;DR - You should vote for this one. It's faster and smarter. A Snake AI has several objectives: 1....
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
guido: This solution is awesome! I just have one (software engineering) suggestion -- find a better name fo...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
Cjkjvfnby: There is function **has_magic** inside glob module :)
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
Cjkjvfnby: There is a lot of simple solutions in clear category. I don't like all of them, because them check a...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
nickie: Cutting the search when your subset has exceeded half the sum is a decent optimization, but it does ...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
veky: Very simple, and I'm actually surprised it works. :-) Few details: line 6: "continue" would much bet...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
veky: You should just publish your code when you solve it, not paste it here in the forum. That way much m...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
nickie: Some of what I'll say has already been discussed, but let me add my two cents. There are several way...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
veky: Thanks. What do you think of "su\x6d"? :-)
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
nickie: I prefer "mus"[::-1] :-)
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
Cjkjvfnby: I like article **Python Tips, Tricks, and Hacks** http://www.siafoo.net/article/52. It is very usefu...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
Sim0000: In check_solution(func, goal) of self-checking code, max turn is 7 instead of 8. for step in range(7...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
username724: Game Theory & Cipher Text ========================= For the purpose of the task and for general game...
|
Nov. 23, 2017, 1:43 p.m. |
+ 1 |
for Comment
Cjkjvfnby: I prefer to use 'timeit' module on my local PC to check working time :)
|