• 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
minib00m Avatar
Name:Krzysztof Lewko
Clan:MIMUW
Member Since:Jul 2016
Last Seen:Jun 2022
Profiles:
Following:51
Followers:52
Allies:48
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (23)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • eymeter
    • commented on "Remove duplicates from list" haskell solution
    • 10 months ago

    yeah no you have to implement your own

  • Custom User Avatar
    • Grecks
    • commented on "First non-repeating character" python solution
    • 14 months ago

    This solution has O(n) runtime over the size n of the input, which is good. It still needs a second pass over (part of) the input, though, which could mean all of the input in the worst case (e.g. when there are no non-repeating characters or the first one occurs late in the input). If you're interested in a solution that does not need a second pass through the input, take a look at my solution.

  • Custom User Avatar
    • Grecks
    • commented on "First non-repeating character" python solution
    • 14 months ago

    +1 for reminding me of the extremely useful collections.Counter! Surely I would have implemented the counting myself using a regular dict if I had opted for it in my solution.

  • Custom User Avatar
    • BITniki
    • commented on "First non-repeating character" python solution
    • 2 years ago

    Seems like your N's is to small to see benefits from Counter. Your solution is O(n^2), so for large N, your solution will be much slower than op's solution (wich is O(n))

  • Custom User Avatar
    • Liamzy
    • commented on "Remove duplicates from list" haskell solution
    • 3 years ago

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

  • Custom User Avatar
    • MrClon
    • commented on "First non-repeating character" python solution
    • 3 years ago

    In my benchmark function with Counter was much slower (like 10 time slower) then function with str.count. str.count run N times only if first non-repeating char is last char of string. And str.count itself has O(N) only in worst case

  • Custom User Avatar
    • Mridul7891
    • commented on "First non-repeating character" python solution
    • 4 years ago

    Nice

  • Custom User Avatar
    • The Catbus
    • commented on "You're a square!" haskell solution
    • 5 years ago

    Fails for (1001)^2

  • Custom User Avatar
    • alexmitelman
    • commented on "First non-repeating character" python solution
    • 7 years ago

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

  • Custom User Avatar
    • essic
    • commented on "Remove First and Last Character" haskell solution
    • 8 years ago

    I really do need to work on my knowledge of the prelude functions. I tend to not rely enough on them.

  • Custom User Avatar
    • scrdest
    • commented on "First non-repeating letter" python solution
    • 8 years ago

    Thanks for taking the time to answer - you've got a good point, I didn't consider that. The difference is going to be well worth the import.

  • Custom User Avatar
    • codyhan94
    • commented on "First non-repeating character" python solution
    • 8 years ago

    If you count for each iteration of your loop, your algorithm is O(N^2) where N is the length of the input string. Using a counter makes one pass over the entire string, then gives you constant time lookups for the loop. You end up using O(N) time and space for this solution.

    Just as an aside - if you were to try to build the counter by using repeated calls to str.count, you would be incurring a quadratic time penalty, because you'd have to call str.count for each letter in the input.

  • Custom User Avatar
    • scrdest
    • commented on "First non-repeating letter" python solution
    • 9 years ago

    Is there any particular reason to use Counter over string.count() here?

  • Custom User Avatar
    • wichu
    • resolved an issue on "Calculate BMI" kata
    • 9 years ago

    Description added.

  • Custom User Avatar
    • MarcoXerox
    • commented on "Sum of primes" kata
    • 9 years ago

    I don't know why I cannot edit the example test cases after re-publishing several times. You need to calculate all primes less than 3 million. That is what P[i] <= 3000000 for all i means.

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

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...