Ad
  • Default User Avatar

    Had to dust off some old maths to understand this one :shame:

    I think we'll mostly agree that this is cool, but isn't great for people who forgot (or never learned) the required math. So I got curious, should I write code like this even if some coworkers struggle to read it later? For the sake of performance, maybe? So I did some testing with hyperfine and... it depends, but it's pretty neat.

    • With small values (all tests), no. My "dumb" answer was actually slightly (but still insignificantly) faster.
    • With big enough values, though, there's no comparison. Math wins by far and the gap gets larger the higher you go.
  • Default User Avatar

    Well, that's embarassing. Thank you for explaining, definitely not an issue.

  • Custom User Avatar

    The input isn't 'consecutive CApitals' that's what your function returned. Print the input to see what it is. Not a kata issue.

  • Default User Avatar

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