• Custom User Avatar

    man, I'm speechless, what a clever solution

  • Custom User Avatar

    I mean, come on... look at my solution and how I sweat with it, and you just did a^b – it feels like cheating, haha ^^'

  • Custom User Avatar

    Gotta say, I don't really understand why this works the way it works intuitively, but people complaining that this isn't "best practice" or "uh muh readability", "maintainability", or "what about junior devs":

    This is a code exercise, not production code.
    Yes, in production you'd want better guard rails and input validation, and yes, you would want this documented to explain what it does. And yes, you'd need to validate that the ouput is sane since multiple odd occurances throws the math out the window lol (so maybe that would make this solution invalid for production as extra compute might outweigh the space benefits).

    However, as a general point you shouldn't sacrafice performance of something so simple with a very clear objective to write more convoluted looping code that will take a junior some time to parse anyway.

    If you know a clever way to do something that's performant, is little code, and achieves a clear focused objectives, you shouldn't dumb it down because someone might not get it. Let them figure it out, and learn, and make sure the rest of the codebase isn't impacted by someone not understanding a bit of code in it.

  • Custom User Avatar

    Finally, holy, that was tough, spent 3 days, but the satisfaction is huge.
    At first I didn't notice that I had to fit into 280 characters – wrote 1700 :D

  • Custom User Avatar

    For some reason I expected this kata to have some trick math solution, but alas, it's pretty straitforward.

  • Custom User Avatar

    Ok... I must have missed the "down" in the description.

  • Custom User Avatar

    Note: the result should be rounded down to the nearest integer.

  • Custom User Avatar

    The first test case is always false since the test was defined incorrectly. So it is impossible to "solve" this Kata.

    It must be assert Solution.predictAge(65,60,75,55,60,63,64,45) == 87 not 86!

  • Custom User Avatar

    Oh, down, thank you.

  • Custom User Avatar

    From the description:

    Note: the result should be rounded down to the nearest integer.
    
  • Custom User Avatar

    Ok, if after all actions i'll get 3.5, in which way i should round? To 3 or 4?

  • Custom User Avatar

    Doesn't work in Kotlin (sqrt). rounding does not follow the rules of mathematics

  • Custom User Avatar

    I'm shocked, never knew it could be done in 1 line! Very smart, kudos from me

  • Custom User Avatar

    Are you human? 🤣🤣🤣

  • Custom User Avatar

    I agree. Its an unnecessary closure.

  • Loading more items...