Ad
  • Default User Avatar

    What is the initial value of min in this example?

  • Default User Avatar

    You can replace

    (1 until number).map(_.toLong)
    with
    (1L until number)

    Scala will infer that the range should be of type long by the type of the start of the range. I'm pretty certain that this should be more efficient as it should just create the range once as the correct type, rather than create one Int range, and then one Long range.

    You could also change
    if(a%3==0||a%5==0)true else false
    to
    (a%3==0||a%5==0)
    Both do the same job, but the second is clearer and should be more efficient because it doesn't need to use a bool to look up a bool.

  • Default User Avatar

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