• 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
Warhaddock Avatar
Name:Unknown
Clan:University of Oxford
Member Since:May 2017
Last Seen:Jul 2022
Profiles:
    Following:82
    Followers:80
    Allies:80
    View Profile Badges
    • Stats
    • Kata
    • Collections
    • Kumite
    • Social
    • Discourse
    • Conversations (10)
    • Replies
    • Authored
    • Needs Resolution
    • Custom User Avatar
      • jurovision
      • commented on "Reversed sequence" java solution
      • 5 months ago

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

    • Custom User Avatar
      • Saigone
      • commented on "Reversed sequence " java solution
      • 3 years ago

      :)

    • Custom User Avatar
      • elmstedt
      • commented on "Stanton measure" r solution
      • 5 years ago

      This will fail if arr contains any NA or NaN elements.

    • Custom User Avatar
      • eg3
      • commented on "Reversed sequence " java solution
      • 5 years ago

      Thank you!

    • Custom User Avatar
      • Chrono79
      • commented on "Reversed sequence " java solution
      • 5 years ago

      About the how: when the loop has only one line inside you can omit the curly braces, it's not so clear but if you're careful with indentation it can be read too. As the why, I don't have your answer, maybe the OP can answer that one.

    • Custom User Avatar
      • eg3
      • commented on "Reversed sequence" java solution
      • 5 years ago

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

    • Custom User Avatar
      • Warhaddock
      • commented on "Santa's Missing Gift List" python solution
      • 8 years ago

      Amazing! Thanks very much for the explanation

    • Custom User Avatar
      • lechevalier
      • commented on "Santa's Missing Gift List" python solution
      • 8 years ago

      GISTS list is very particular: each key is a power of 2.

      2^0 = 1, 2^1 = 2, 2^2 = 4, 2^3 = 8...
      

      If you think in binary representation, each key is tied to one particular bit, then each gift corresponds to this very bit.

      1 =   0b00000000001
      2 =   0b00000000010
      ...
      256 = 0b01000000000
      512 = 0b10000000000
      

      Take the binary representation of a number n and look at each of its turned on bit (1).
      It gives you a list of gifts as one bit matches one gift.

      n = 35 = 0b0000010011 = 0b0000010000 + 0b0000000010 + 0b0000000001 = 32 + 2 + 1
      answer = (GIFTS[32], GIFTS[2], GIFTS[1])
      

      Finally all you need to do is to sort the answer to output an alphabetically sorted list.

      Is it more understandable now?

    • Custom User Avatar
      • Warhaddock
      • commented on "Santa's Missing Gift List" python solution
      • 8 years ago

      how does this work? I am confused by the if statement. Why do you not need to match the toy key to the number and then reduce the number by the amount of the key?

    • Custom User Avatar
      • Warhaddock
      • commented on "Common Denominators" kata
      • 8 years ago

      Thanks Alyona42

    • © 2025 Codewars
    • About
    • API
    • Blog
    • Privacy
    • Terms
    • Code of Conduct
    • Contact

    Confirm

    • Cancel
    • Confirm

    Collect: undefined

    Loading collection data...