Ad
  • Custom User Avatar

    Couldn't it happen that the year was 0001?

  • Default User Avatar

    Let's say we have a year 11100

    That's the thing, this kata only tests 4 digits years.

    The input will always be a 4 digit string

  • Custom User Avatar

    This solutions is slightly incorrect for it's not working for every given year.
    Let's say we have a year (Just an assumption) 11100.
    It will return a proper age but wrong suffix.
    Your algorithm is not following a rule where every number with tens digit number has to be suffixed with 'th'.
    Even tho, I think it's a very clever idea and it needs just a bit of polishing.

    Btw. I know that my example is quite strange but I just think that algorithm written once should be able to handle cases for years without need of being rewritten. :)
    I will optimize and correct my own answer and show it to the world.

  • Custom User Avatar

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