Yes i am cianging the values in input array. its long [] array. Its simple swap, thats allowed in java as far as I understand. Or Is this the requirement of the kata not specifically java.
new long[] {1,2,9,-4,-2,-6 }) so for this my code would do in place swap on the array and produce new long[] {-6,-2,-4,9,2,1 }, why would this be wrong.
Getting the following error
testDoNotChangeInput
Input array must not be mutated: arrays first differed at element [2]; expected:<471358> but was:<-10968>
Stack Trace
Could someone give me the input for the above test. Not sure what I am missing, thanks
have question on this
Testing [107, 158, 204, 100, 118, 123, 126, 110, 116, 100]
There should be only one unique prime factor for 1262 found []
Actual (2 932)(3 453)(5 210)(7 126)(11 110)(17 204)(29 116)(41 123)(59 118)(79 158)(107 107)
Expect (2 1032)(3 453)(5 310)(7 126)(11 110)(17 204)(29 116)(41 123)(59 118)(79 158)(107 107)
I am not understanding the above of how (2 932) is not correct.
2 is a factor of 100, 116, 118, 204, 158, 126, 110
that should make it (2 932) how is it (2 1032) what am i missing here ?
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]]
This kata is not explained well, I have two queries if some one can help
It can happen that a sum is 0 if some numbers are negative!
Example: I = [15, 30, -45] 5 divides 15, 30 and (-45) so 5 appears in the result, the sum of the numbers for which 5 is a factor is 0 so we have [5, 0] in the result amongst others.
I dont get how the kata get 5,0 even 3 divides 15, 30 and 45
yes i figured and did it...:)
In other words, what hobovsky is saying is that you need to make a copy of input array.
Yes i am cianging the values in input array. its long [] array. Its simple swap, thats allowed in java as far as I understand. Or Is this the requirement of the kata not specifically java.
new long[] {1,2,9,-4,-2,-6 }) so for this my code would do in place swap on the array and produce new long[] {-6,-2,-4,9,2,1 }, why would this be wrong.
You should read these instructions too ;)
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.
Hi guys have a small issue...
Getting following error
testDoNotChangeInput
Input array must not be mutated: arrays first differed at element [2]; expected:<471358> but was:<-10968>
Stack Trace
Can someone give me the input for testDoNotChangeInput, Not sure what is happening ? I am uinsg long
Hi all need help with this...
Getting the following error
testDoNotChangeInput
Input array must not be mutated: arrays first differed at element [2]; expected:<471358> but was:<-10968>
Stack Trace
Could someone give me the input for the above test. Not sure what I am missing, thanks
thanks...yup two times...so thats a bug in my code...will fix it
How many times do each of those numbers that 2 is a factor of occur?
have question on this
Testing [107, 158, 204, 100, 118, 123, 126, 110, 116, 100]
There should be only one unique prime factor for 1262 found []
Actual (2 932)(3 453)(5 210)(7 126)(11 110)(17 204)(29 116)(41 123)(59 118)(79 158)(107 107)
Expect (2 1032)(3 453)(5 310)(7 126)(11 110)(17 204)(29 116)(41 123)(59 118)(79 158)(107 107)
I am not understanding the above of how (2 932) is not correct.
2 is a factor of 100, 116, 118, 204, 158, 126, 110
that should make it (2 932) how is it (2 1032) what am i missing here ?
The case 5,0 was only an example...
ok that makes sense...that is what i was thinking...the way kata is described it never lets that on...i thought it was saying it can only be 5,0
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]]
This kata is not explained well, I have two queries if some one can help
It can happen that a sum is 0 if some numbers are negative!
Example: I = [15, 30, -45] 5 divides 15, 30 and (-45) so 5 appears in the result, the sum of the numbers for which 5 is a factor is 0 so we have [5, 0] in the result amongst others.
I dont get how the kata get 5,0 even 3 divides 15, 30 and 45