If you were to go from left to right, the first two elements that sum to 10 are 3 and 7 at indices 3 and 4, respectively. While the first 5 may have been found at index 1, the matching 5 lies at index 5, which is past the match of [3, 7].
Basically, you need to return the pair of numbers that both occur before any other pairs. (The last element of the pair [3, 7] comes before the last element of the pair [5, 5])
I can only imagine the reason being the way Java is converting the hyphen char to an int. If that's assuming a value of -1 for the -, it would be adding a 1 to the beginning of your returned string.
I found an issue with the java test cases as well. The instructions direct one to return false on zero or negative radius, but the default test cases expect an IllegalAgumentException to be thrown.
Fixed.
This comment is hidden because it contains spoiler information about the solution
It also occurs in js
I changed the description and the problem. Is it better now?
Thanks for the feedback.
Oops. I thought your comment was a reply to mine. I deleted my reply.
If you were to go from left to right, the first two elements that sum to
10
are3
and7
at indices3
and4
, respectively. While the first5
may have been found at index1
, the matching5
lies at index5
, which is past the match of[3, 7]
.Basically, you need to return the pair of numbers that both occur before any other pairs. (The last element of the pair
[3, 7]
comes before the last element of the pair[5, 5]
)This comment is hidden because it contains spoiler information about the solution
I can only imagine the reason being the way Java is converting the hyphen char to an int. If that's assuming a value of -1 for the -, it would be adding a 1 to the beginning of your returned string.
I found an issue with the java test cases as well. The instructions direct one to return false on zero or negative radius, but the default test cases expect an IllegalAgumentException to be thrown.
*Sorry for error i'm italian hehehehehe
I really wish I could help you. While the Kata is mine, I only know Python. The other languages are written by other people and I don't know Java.