Shouldn't the solution for n=-1 be NaN, rather than 'NaN' which is a character array?
I agree with Ken , we expect NaN and not the string 'NaN'
I believe you should also change the assert for the case n=-1 to be isequalwithnan, since isequal(NaN,NaN) is false.
yeap you have just rescored the problem but you need to use isequalwithnan,
actually you need to use isequalwithequalnans
tests 5 and 6 does not work properly. those numbers are out of precision, and for test 6 it couldn't be fixed even with uint64 used instead of type double
This problem is simply wrong. The right answer is
sum(1:2^(n^2-1))
if we where to sum ALL the grains on the board....
Sorry for cheating, I didn't notice that there is string 'NaN' in test suite.
Find the numeric mean of the prime numbers in a matrix.
6831 Solvers
Count from 0 to N^M in base N.
220 Solvers
All your base are belong to us
464 Solvers
Rotate input square matrix 90 degrees CCW without rot90
385 Solvers
Celsius to Fahrenheit converter
398 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!