• 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
ghostbug Avatar
Name:Unknown
Clan:Unknown
Member Since:May 2015
Last Seen:Jul 2022
Profiles:
Following:1
Followers:1
Allies:1
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (88)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • MircoT
    • commented on "The highest profit wins!" python solution
    • 7 days ago

    ok, that's your opinion, facts tell a different story on performance...

  • Custom User Avatar
    • CClairvoyant
    • commented on "The highest profit wins!" python solution
    • 8 days ago

    Python's standard library functions are implemented in C, so not only is this solution cleaner, it's also significantly faster, than your reinvent-the-wheel solution.

  • Custom User Avatar
    • Shubham6429
    • commented on "The highest profit wins!" python solution
    • 3 months ago

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

  • Custom User Avatar
    • Hage-Tassang
    • commented on "The highest profit wins!" python solution
    • 3 months ago

    we think same xd..... simplicity is best

  • Custom User Avatar
    • IvanGS06
    • commented on "Last digit of a large number" python solution
    • 16 months ago

    This solution have a problem with n1 = n^x and n2 = m^y

  • Custom User Avatar
    • Azoz-focus
    • commented on "Last digit of a large number" python solution
    • 16 months ago

    these types of questions convinced me to start learning number theory, mind if you tell me specifically whats this about?

  • Custom User Avatar
    • tsoialex82
    • commented on "Last digit of a large number" python solution
    • 16 months ago

    me too)))

  • Custom User Avatar
    • FriskTemmie
    • commented on "The highest profit wins!" python solution
    • 2 years ago

    first time I solved something so easily and it was the first solution (I'm always trying to get the same solution as the first, even if I know how to write it less elegantly)

  • Custom User Avatar
    • theAmazingJunkman
    • commented on "Last digit of a large number" python solution
    • 2 years ago

    Wow, I used number theory in my solution, but it wasn't anywhere near this compact

  • Custom User Avatar
    • mauro-1
    • commented on "Last digit of a large number" python solution
    • 2 years ago

    No, it is fast.

  • Custom User Avatar
    • o2001
    • commented on "The highest profit wins!" python solution
    • 2 years ago

    I'm not too sure, but I think these builtins are internally written in C, making them automatically blazing fast. Calling the solution "horribly inefficient" is really dramatic. On the grand scheme of things, this is still an O(n) solution. It is also incredibly readable. I have run some cursory benchmarks and the "inefficient" method gobsmacks yours for all list lengths I've tried (we're talking around more than 3x faster than yours). Take this with a grain of salt since they're informal tests, but it should hopefully make you reconsider making hasty performance comments in the future. I'll attach it spoilered below.

  • Custom User Avatar
    • bineapple
    • commented on "The highest profit wins!" python solution
    • 2 years ago

    can't think of any other solution

  • Custom User Avatar
    • p3yif102
    • commented on "Last digit of a large number" python solution
    • 2 years ago

    #11bfr_42x

    your solution is very elegant . thanks for the intel .
    python is a black art .

  • Custom User Avatar
    • akar-0
    • commented on "The highest profit wins!" python solution
    • 2 years ago

    No. If you parse the array twice it's still O(N) (O(2N) == O(N)). O(N^2) would be the case of a nested loop.

  • Custom User Avatar
    • phaseon1224
    • commented on "The highest profit wins!" python solution
    • 2 years ago

    Your reply is non-sensical...I'm not sure where language comes into play here.

    This solution runs in O(N^2) because it requires iterating through the array twice before returning.

    With a two pointer solution, you traverse the array once, in O(N), which is more efficient.

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

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...