Given an m*n matrix, see if a matrix contains any 0s in any row. if it contains 0 anywhere in any particular row, delete that row and fill that row with random integer values between 3 to 15. For example: mat = [3 2 1 3; 3 0 0 1; 0 4 3 1]; answer = [3 2 1 3; 4 7 5 12; 4 9 10 14]
The test suite of this problem has been updated to actually check for numbers in the specified range (between 3 to 15), so your random solutions should now work.
Any chance you could make the test suite see if the numbers are actually random? :-)
It's actually quite a difficult thing to do well. See for example Problem 44393 at https://www.mathworks.com/matlabcentral/cody/problems/44393 , which so far has only one solver (in addition to my reference solution). Cf. the Test Suites in Problem 174 by Bryant Tran and Problem 44277 by Amitava Biswas. —DIV
(Here it's a little easier because the author can repeatedly call the user's function with the same input, and check for variation in the returned output.)
David, that's kind of what I meant by checking to see if the output was random. Run the code maybe 10-15 times, and see if the values are different each time would be "random enough" for Cody.
337 Solvers
451 Solvers
Generate a random matrix A of (1,-1)
161 Solvers
Compute LOG(1+X) in natural log
169 Solvers
23 Solvers