Ad
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    How would that make it harder?

  • Custom User Avatar

    3 = Date of Birth (In the format Day Month Year, this could include the full Month name or just shorthand ie September or Sep)

  • Custom User Avatar

    It is explained why Paul is selected, what do you mean you're mislead?

    return: the firstname of the participant whose rank is n (ranks are numbered from 1)

    You shouldn't return the winner, that's not what is asked.

  • Custom User Avatar

    No need, there is already this and this

  • Custom User Avatar

    When I first had the idea for this kata, I coded it up with the arrays of odds/evens etc. It's the natural starting point. It wasn't until I was checking the code through tests that I realised a neater solution. I then decided to be mean and time everyone else out 😂. It wasn't until I saw the commenting on one of the python solutions that I actually realised why the quick way works.
    The really important lesson here is, if your code times out, the reason is likely your approach and not a bunch of tiny micro-optimisations. If your O(n) solution times out, then there must be a mathematical pattern hiding somewhere...

  • Custom User Avatar

    Done :-) The code was really one of the simpliest I've ever written. On the other hand I'm glad I found the other way too, even though it was showing the error. I learned a few new things along the way. I let the previous version commented in my code, if anyone wants to see my dead end solution :-)

  • Custom User Avatar

    Yeah, I created arrays :-) Not instead of thinking about the smpler way though. I was thinking quite a lot. I'm a beginner in python and I've never been good in math (30+ years ago back in the school...). I mangaed to write a code though that works, although it shows the memory error. I take it as my small victory :-)
    Here's my latest attempt....well, it seems like it can't be pasted here. Nevermind. I'm not going to rewrite the whole line.

  • Custom User Avatar

    OMG! Who else created arrays of odds and evens instead of thinking of the simple way to do it? It took me ages, feel so stupid....

  • Custom User Avatar

    I've been thinking about it for about five days and I have no clue what to do with that. I know I'm stupid. I'm writing it here just so the others felt less stupid, knowing they're not alone :-D

  • Custom User Avatar

    Why did it take you so long?