Problem 73. Replace NaNs with the number that appears to its left in the row.
The problem does not limit the array to a single row. Add a few cases of multiple rows or define as single row.
x = [1:10 NaN];
y_correct = [ 1:10 10];
1 2 3 4 5 6 7 8 9 10 NaN
Output argument "y" (and maybe others) not assigned during call to "replace_nans".
Error in Test4 (line 3)
why wont this pass?
Not really a solution, more like a "white flag" regarding this direction.
I just realized that you can cause inconvenience to some players by posting cody problems like "Hello Everyone!!!". I did create that cody problem just to say Hi to my fellow cody players. It was not intended to waste your time or cause inconvenience. My apologies for whoever deleted that problem.
I am sure it was deleted by mistake, there are plenty of similar Cody problems (think Chuck Norris, indian mathematicians, smartest matlab programmers, and a long etc...) Perhaps Ned can put it back up?
Thanks for the reply sir.
Strange...those assertions pass on my computer
For the second test it gives: [0 0 1 2 2 2 17 3 -4] instead of [0 1 2 2 2 17 3 -4 -4]
Nice, it is very intuitive that a solution with this function is possible but still hard to find.
It's like a lesson. logical indices don't have to be full size! And for will apparently loop through a vector! Thanks!
Bonus! Vector doesn't have to be monotonic!
Problem Recent Solvers2621
Find the numeric mean of the prime numbers in a matrix.
Project Euler: Problem 7, Nth prime
Project Euler: Problem 8, Find largest product in a large string of numbers
Getting the indices from a matrix
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!