• ###### AnthonyBanecommented on "Scramblies" python solution

This is not efficient

• ###### LiterallyBlahcommented on "Scramblies" python solution

Using .count() inside a loop is quite costly. An alternative is to use 'Counter' from the 'collections' library:
from collections import Counter

• ###### Blind4Basicscommented on "Scramblies" python solution

yeah, but with the spoiler flag, thx (comments are visible from the dashboard)

• ###### Deadtalkercommented on "Scramblies" python solution

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

• ###### z0s3r77commented on "Scramblies" python solution

@rowcased i can only say thanks..... I was searching for an explanation to the kata and the example is.... an explanation by self

• ###### gunstencommented on "Scramblies" python solution

True, the fact that the alphabet is limited makes my analysis too pessimistic.

A standard implementation of str.count(char) entails an iteration through the elements of str. Without knowing the details of the Python implementation, it is most likely still an expensive operation. The solution is far from optimal and shouldn't be considered best practice. "Too slow" still holds.

You can solve the problem and only loop through s1 and s2 once respectively.

• ###### Titophilipcommented on "Scramblies" python solution

The timeouts are because the iterations are on s2 can be over 600,000. Using set(s2) limits the iteration to 26 because there are only 26 unique aphabets, so the iterations are 26 or less.

• ###### SaurabhCODEcommented on "Scramblies" python solution

Great example @rowcased hahaha

• ###### SaurabhCODEcommented on "Scramblies" python solution

Because in string there are lot of repeated letters while `set(s2)` keep only one of them. So only iterating once per letter.

• ###### Chrono79commented on "Scramblies" python solution

Please use spoiler flag next time.

• ###### KasperPycommented on "Scramblies" python solution

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

• ###### sweetie.pycommented on "Scramblies" python solution

I had the same solution but met Time Limit Exceed. I used Counter instead

• ###### MrFrammcommented on "Scramblies" python solution

Now this won't pass all test, cause it's slow.

• ###### nikhiljerry29commented on "SQL Basics: Simple NULL handling" sql solution

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