• lexabugcommented on "Find all pairs" python solution

Oh, I see. Thank you.

• RazNaotcommented on "Find all pairs" python solution

The custom in this site for the easier katas, is not to be restricted by performance and memory constraints. At most katas leveled kyu 8 to kyu 6, almost all algorithms will work. They are meant to be easy training, with fewer and smaller test cases - so just do something that works and you'll pass. The harder katas - around kyu 5,4 and up may require "performance" - i.e. slower algos may fail etc. Browse "Kata" on the top left menu to get to harder questions...

• lexabugcommented on "Find all pairs" python solution

Did anyone check the complexity of this solution?
It's very short and nice, but is it optimal in terms of CPU/RAM usage?
As I can see we will get one list traversal for getting a set. Then we will get a traversal per each element in the set. Which i think is suboptimal.
Thoughts?

• OQthcommented on "Alternating between three values" python solution

This comment is hidden because it contains spoiler information about the solution

• andy_lzcommented on "Sorting by bits" python solution

why I don't know '.count()'

• Bladedrinkscommented on "Alternating between three values" python solution

This comment is hidden because it contains spoiler information about the solution

• Bladedrinkscommented on "Alternating between three values" python solution

Thanks a lot for your generic solution, which is really really impressive.
I learned a lot from it. And for the sake of my understanding, I added some comments to your source code.

• Blind4Basicscommented on "Alternating between three values" python solution

yes, that's it. For instance, here is what it could look like, having a generic solution.

• Bladedrinkscommented on "Alternating between three values" python solution

Are you sure that '3' comes from the number of arguments?

Well, I think you might've meant the number of parameters except 'x', which is also the length of
the list containing a, b, c, etc., right?

And I should've said, "Before replacing '3' with 'len(l)', you have to manually type in as many parameters as you want."

• Blind4Basicscommented on "Alternating between three values" python solution

that won't be more generic since the 3 comes from the number of arguments. ;p
And if you make it more genrice with any number of values, this will become especially inefficient because of `index`.

• Bladedrinkscommented on "Alternating between three values" python solution

Very impressive!
You also inspired me!
To make it more generic, we can replace '3' with len(l).

• anter69commented on "Row Weights" python solution

You have a good point there, indeed.

I would measure it against a simple `if index is even .. else` loop, but that's probably not any faster. Thanks for the heads up!

• fenring76commented on "Row Weights" python solution

IIRC, a slice has a time complexity of O(k) (with k == the number of items). So, going over two halves of the array are roughly equivalent to going over the array once. I imagine there is a bit of overhead for the stepping, but I doubt it's much. I'm really not sure how you'd optimize this code in pure python.

• anter69commented on "Row Weights" python solution

Not really best practice, because you traverse the array twice, but at least it's clear :-)

nice one