Ad
  • Custom User Avatar

    If you look at it from a performance point of view, this solution will benefit when compared with a solution that uses Sequence. During my research, Sequence takes between 5 and 13 seconds, while a solution based on while takes 0 seconds

  • Custom User Avatar
  • Custom User Avatar

    This should not be marked as "best practice" as it isn't best practice to write a loop and use mutable vars in Kotlin... Instead code like this is mainly used by straight forward programmers that have not yet seen clear, expressive functional code. ;-) Also I would state that there is a loophole in the whole Kata. Expressing the number of current people as double makes me think: does the author of the Kata want people at the end of every year to be counted as halfs or quarters or instead truncate all "not-yet-one" people? Seems to me, there would be some differences with some test cases...