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
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.
Solve the Sudoku Row
Back to basics 15 - classes
Is this matrix orthogonal?
Getting logical indexes
Create an n-by-n null matrix and fill with ones certain positions
Wheat on a chessboard pt 2
Calculate Alcohol By Volume with Original and Final Gravity
Will there be a new leader?
Possible Outcomes of American Roulette
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office