• 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
Ankit-rana Avatar
Name:Ankit Rana
Clan:Cray
Skills:python, c, storage
Member Since:Apr 2016
Last Seen:Aug 2024
Profiles:
Following:13
Followers:13
Allies:13
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (20)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • pavloslav
    • commented on "Some (but not all)" python solution
    • 10 months ago

    First, you should never claim something is faster without actually benchmarking it. Python has many hidden optimizations in built-in functions.

    Second, I guess my solution would be faster in most cases because any stops at the first True, and all stops at the first False, so it would only reach the end of the sequence if it consists of all equal elements. Your algorithm will reach the end in any case. Consider the situation [True, False, ...(10000 elements more)]. My algorithm will stop after checking the first two elements; yours will check all the sequence in any case.

    On the second thought, it would be faster in any case except, maybe, some very short sequences, because the first value of predicate would be either True or False, so one of the any or all functions is guaranteed to stop after checking it.

  • Custom User Avatar
    • Ankit-rana
    • commented on "Some (but not all)" python solution
    • 10 months ago

    For your solution, I missed the iterator part in map. yes, the space complexity will be O(1) but then it is a slower iteration over sequence. a simple loop should be faster. Mind me I understand that they both are O(n) time complexity but simple loop should be a faster O(n) out of those two. let me know what you think.

  • Custom User Avatar
    • Ankit-rana
    • commented on "Some (but not all)" python solution
    • 10 months ago

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

  • Custom User Avatar
    • pavloslav
    • commented on "Some (but not all)" python solution
    • 10 months ago

    How exactly creating new structures in memory can be more efficient? This solution has O(1) space complexity.

  • Custom User Avatar
    • Ankit-rana
    • commented on "Some (but not all)" python solution
    • 10 months ago

    i think counter method is more efficient space wise. however , it has same time complexity

  • Custom User Avatar
    • CClairvoyant
    • commented on "Points of Reflection" python solution
    • 11 months ago

    Unnecessary parentheses.

  • Custom User Avatar
    • CanLuca
    • commented on "I love you, a little , a lot, passionately ... not at all" python solution
    • 2 years ago

    Bad

  • Custom User Avatar
    • anter69
    • commented on "The Lazy Startup Office" kata
    • 5 years ago

    Fixed

  • Custom User Avatar
    • Ankit-rana
    • commented on "Create new programming mechanism to add numbers " kata
    • 6 years ago

    added two instance of add![x, y]

  • Custom User Avatar
    • Unnamed
    • commented on "Create new programming mechanism to add numbers " kata
    • 6 years ago

    I suggested 2 instances of add![x, y] with different values of x and y at runtime. Of course, that would still be hardcodable, but just a bit less straightforward...

  • Custom User Avatar
    • Ankit-rana
    • commented on "Create new programming mechanism to add numbers " kata
    • 6 years ago

    I can see the problem now but i am afraid i have no ideas of how to stop this problem. Please suggest me if we have standard way of avoiding this problem in codewars.
    Thanks in advance.

  • Custom User Avatar
    • Unnamed
    • commented on "Create new programming mechanism to add numbers " kata
    • 6 years ago

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

  • Custom User Avatar
    • Ankit-rana
    • resolved a suggestion on "Create new programming mechanism to add numbers " kata
    • 6 years ago

    Added two test cases without values in error messages

  • Custom User Avatar
    • Unnamed
    • created a suggestion for "Create new programming mechanism to add numbers " kata
    • 6 years ago

    How about some tests to make sure solutions aren't hardcoded based on error messages? Something like

    let x = ..., y = ...;
    ... add![x, y];
    let x = ..., y = ...;
    ... add![x, y];
    
  • Custom User Avatar
    • Unnamed
    • resolved an issue on "Create new programming mechanism to add numbers " kata
    • 6 years ago
  • Loading more items...
  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...