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.
Awesome, opened an issue on the codewars-runner-cli repo. Thank you!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Had the very same idea :P, nice use of
path
!@OP how about describing the general spirit of the challenge?
Something like, "Please avoid using built-in file parsing libraries."
Check out the fork for the real party...
I thought about this some more, and I think it's actually a loss of performance to extract
s-i
intol
...In every case except the last one
seen[l]
will be falsey. Only once will you have to subtract again. The rest of the time you're wasting time assigning to a variable / reading from a variable instead of using the expression value immediately.v8 may be smart about these things and do the fast thing in either case. The only way to really judge optimizations is to measure.
The other factor is maintainability: I'd say it's a little nicer to extract the same expression into a single variable.
This comment is hidden because it contains spoiler information about the solution
@Hourann, very interesting observation! This is the stuff of hacks...
I traced the
socket.inet_pton
implementation to some c code in the standard library exported here. It appears to have two implementations: this one & this one. It may be an interesting exercise to see where this octal behaviour starts to appear. There's even a chance that the standard python library is inconsistent with itself between operating systems. That would be something worth reporting, or contributing.I was curious about whether a leading zero is even allowed in IP addresses which lead me to this superuser question. Looks like the spec never bothered to define it.
This kata asks speciifically for "dot-decimal format", and according to the wikipedia page, "... where an IP address component is written with a leading zero digit may be interpreted differently by different programs: some will ignore the leading zero, some will interpret the number as octal." and mentions this citation.
So it looks like there's just a pinch of ambiguity to the question, and my answer just does what python standard library implementers chose to do.
Thanks for leading me on this interesting investigation! Hope you found this info interesting as well...
http://stackoverflow.com/questions/9623114/check-if-two-unordered-lists-are-equal
-- and I realized it was much nicer to use a generator comprehension for the all argument
no need for
break
if it's preceded by areturn
Huh, what an interesting way to declare a local variable in the arguments. Cool :).
Do all solutions get re-run after changes to a kata's tests? Are points revoked for newly failed solutions?
1: The skeleton uses non-conventional brace formatting, and should be changed to:
2: When I read
x
, I think continuous domain. When I readn
, I think integer. Go withn
, or change the description to usex
. Have them agree in any case.3: Copy-editing is not my expertise, so I'm sorry that this is more of a complaint than constructive feedback. The wording and sentence structure in factorial factory seem more direct, which I prefer.
Hope it helps, and good luck!
This comment is hidden because it contains spoiler information about the solution
Ah, nice! I was trying to do something
Aggregate
-ish, but couldn't quite get it without the anonymous container and the.Incr
on the tail. Sweet ;)Loading more items...