Ad
  • Custom User Avatar

    In other words, what hobovsky is saying is that you need to make a copy of input array.

  • Custom User Avatar

    In Java , you're not allowed to modify the input Array/list/Vector

    It's a test against mutation of input. It does not matter what the input is, your solution fails it because it probably modifies the input array.

  • Default User Avatar

    How many times do each of those numbers that 2 is a factor of occur?

  • Default User Avatar

    The case 5,0 was only an example...

  • Default User Avatar

    a = [15, 30, -45]
    2 is a factor of 30 the sum of numbers divisible by 2 is 30 hence a partial result [2, 30]
    3 is a factor of 15, 30, -45 the sum of numbers divisible by 3 is 0 hence a partial result [3, 0]
    5 is a factor of 15, 30, -45 the sum of numbers divisible by 5 is 0 hence a partial result [5, 0]
    So the final result is: [[2, 30], [3, 0], [5, 0]]