• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
vanadium23 Avatar
Name:Ivan Chernov
Clan:Ostrovok.ru
Skills:comics, beers, python
Member Since:Sep 2016
Last Seen:May 2025
Profiles:
Following:27
Followers:28
Allies:26
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (68)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • Barbhere
    • commented on "Scramblies" python solution
    • 4 months ago

    So easy to read and so nice, I was so proud with my solution until I saw yours.

  • Custom User Avatar
    • john@beyondvoip.net
    • commented on "Scramblies" python solution
    • 11 months ago

    Exactly the solution I came up with :)

  • Custom User Avatar
    • AnthonyBane
    • commented on "Scramblies" python solution
    • 2 years ago

    This is not efficient

  • Custom User Avatar
    • LiterallyBlah
    • commented on "Scramblies" python solution
    • 2 years ago

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

  • Custom User Avatar
    • Blind4Basics
    • commented on "Scramblies" python solution
    • 3 years ago

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

  • Custom User Avatar
    • Deadtalker
    • commented on "Scramblies" python solution
    • 3 years ago

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

  • Custom User Avatar
    • z0s3r77
    • commented on "Scramblies" python solution
    • 3 years ago

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

  • Custom User Avatar
    • gunsten
    • commented on "Scramblies" python solution
    • 4 years ago

    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.

  • Custom User Avatar
    • Titophilip
    • commented on "Scramblies" python solution
    • 4 years ago

    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.

  • Custom User Avatar
    • SaurabhCODE
    • commented on "Scramblies" python solution
    • 4 years ago

    Great example @rowcased hahaha

  • Custom User Avatar
    • SaurabhCODE
    • commented on "Scramblies" python solution
    • 4 years ago

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

  • Custom User Avatar
    • Chrono79
    • commented on "Scramblies" python solution
    • 4 years ago

    Please use spoiler flag next time.

  • Custom User Avatar
    • KasperPy
    • commented on "Scramblies" python solution
    • 4 years ago

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

  • Custom User Avatar
    • sweetie.py
    • commented on "Scramblies" python solution
    • 4 years ago

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

  • Custom User Avatar
    • MrFramm
    • commented on "Scramblies" python solution
    • 4 years ago

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

  • Loading more items...
  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...