Ad
  • Custom User Avatar
  • Custom User Avatar

    I finally made it, and... though i think it's much harder than 5 kyu, it took me about 3 days of visualizing, drawing many simulations on paper, and searching patterns, till i finally cracked the magic algorithm that allows to setup the structure with one loop "for", and assign all collisions on less or equal to a single other loop. 1 million of collisions calculated in a single second, and 10 millions of collisions calculated in about 10 seconds on my laptop, super happy! Thanks for the opportunity to scratch my head that much, without any help, it was the best feeling ever!

  • Custom User Avatar
  • Custom User Avatar

    I can't tell why, but as i read you, i finally got it! Now i know i can do it, thanks a lot!

  • Custom User Avatar

    Hi,

    Not enough example tests. The current ones are mostly useless because anything "slightly" wrong can pass them. At the very least the fixed tests should be added.

    Cheers

  • Default User Avatar
  • Custom User Avatar

    I thought "ant" was a metaphor for "steel ball in Newton's cradle". Never heard a steel ball complaining about a concussion.

  • Custom User Avatar

    I think "ant" in this kata is a metaphor for "human", so hitting our heads, time and time again, seems to be quite accurate.

  • Custom User Avatar

    I'd be more worried about that with a term that includes the word "traumatic". Or maybe our local Animal Party ( yes, we have one, no, it's not PETA, this is an actual political party ) might be triggered by ant abuse, and ultimately we just can't make jokes say anything any more.

    As if ants weren't smart enough to turn around before they hit their head on another ant, given two meters of separation. I don't even know if ants can see two meters.

  • Custom User Avatar

    outdated suggestion

  • Custom User Avatar

    Watch out with the term concussions. It might be some medical term that could trigger some admin here ;) Btw, CTE is a Common Table Expression where I come from.

  • Custom User Avatar

    Don't even try to simulate everything that happens. That's nice to see patterns and validate your solution against smaller inputs ( because it means you can generate tests yourself ), but it's never going to work for bigger inputs.

    There's a reason this kata has a performance tag and a specified upper bound. O(n²) won't cut it; you'll need O(n) or very close to it.

    If it makes you feel better, my first solutions ( yes, plural ) turned out not to be able to handle a million ants either ( though I could handle a hundred thousand; I skipped simulating entirely ).

  • Custom User Avatar

    So, this is my very first kata about optimisation, and i know basically nothing about it. I managed to solve the kata for up to 100 ants, but 10'000 doesn't pass.

    I'll do my researches but if anyone have some recommendations to get my head wrapped on it efficiently, i'm all ears! :D

    It's a great kata though, i like it, even if break my coconut head on it :P

  • Custom User Avatar

    Well, same here, i used the bubble-sort, but i'm still proud of us, as well, we are problem solvers, and we just solved one :D

  • Default User Avatar

    Difficult to decide whether you'd use the ternary for the smallest code or use an if statement to make it more readable for someone else. I guess you'd go with the ternary because a dev should be able to recognise it.

  • Loading more items...