Ad
  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Simple and clean solution!
    1 remark though: if n is rather big, it's not unthinkable that you hit the double min or max value.
    In such cases this code will continue it's calculation and keep outputting infinity.
    It might be cheaper for such situations to just fill the remainder of the array, although you could expect a small performance penalty from checking if your last calculated index contains such value.