Ad
  • Default User Avatar

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

  • Custom User Avatar

    Yup, easy to understand but far slower than a simple loop in this case, particularly because of the function chaining.

  • Default User Avatar

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

  • Default User Avatar

    This solution is too slow and probably times out. Values of r in excess of 1 million are used in tests. Modifying the original array will not work. Need to figure the array index for any given r. I solved it by writing out the results for R from 1 to 35 and looking at the sequence. It has something to do with powers of 2.