"So, as long as the integers and their sum are never larger than 53 bits in magnitude..." "a and b will always be valid integers." , so a and b they always safe or not?
As future reference, functions returning mixed types (boolean/number) is generally considered an antipattern.
a and b will always be valid integers.
That was not the case, maybe you need to edit the discription a bit. User have to check if inputs are still safe.
I got the same error because i was attempting to print the arr while testing my solution. Once I removed the print the kata worked without issue.
That's looking much better.
As a minor point, there are three conditions that can lead to a false result, and you're probably testing only one of them with these test cases. (a+b, and not a or b individually.) For completeness, the random tests should probably have possibilities for any and all of a, b and a+b to be out of bounds, or not. But for a 7kyu kata, this should suffice to weed out the likes of Hacker Sakana and me. :]
Thanks, I think I fixed the random tests.
This is not the way to do random tests. The answer has to be random, not just the arguments. Run random arguments through a reference solution and compare the user answer to that answer, don't just pick random arguments that lead to a predictable answer anyway.
"IIV" is correct roman numeral format. To represet three you would use "III"
solution("IIV") return 2 instead of 3.
Added a three random test cases.
Needs random test cases
This comment is hidden because it contains spoiler information about the solution
Please reread the instructions. You are looking for the number which is not like all the other numbers in the string in terms of evenness or oddness. In other words you are looking for the single odd number or the single even number.
iqTest("1 2 1 1") => 2 // Second number is even, while the rest of the numbers are odd