Cody

# Problem 713. Find the maximum number of decimal places in a set of numbers

Solution 2024034

Submitted on 16 Nov 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
x = [1.000 1.04 0.22 10.1; 2.05 2.33 4.1 1000.31; 5.00010 6.429 7.492 8.0]; y_correct = 4; assert(isequal(find_max_sigdec(x),y_correct))

a = 3×51 char array ' 1 1.04 0.22 10.1' ' 2.05 2.33 4.1 1000.31' '5.0001 6.429 7.492 8'

Output argument "y" (and maybe others) not assigned during call to "find_max_sigdec". Error in Test1 (line 5) assert(isequal(find_max_sigdec(x),y_correct))

2   Fail
N = randi(6,1); x1 = rand(1,100); for k = 1:100 x(1,k) = round(x1(1,k)*10^N)/10^N; end assert(isequal(find_max_sigdec(x), N))

a = '0.2 0.8 1 0.9 0.9 0.3 0.9 0.5 0 0.4 1 0.5 0 0.6 0.3 0.6 0.8 0.1 0.2 0.3 0.8 0.4 0.7 0.9 0.1 0 0.2 0.7 1 0.2 0.8 0 0.7 0.5 0.9 0.1 0.5 0.2 0.9 0.1 0.8 0.1 0.6 0.7 0.5 0.6 0.4 0.1 0.3 0.3 0.1 0.7 0.7 0.1 0.7 0.7 0.4 0.3 0.6 0.1 1 0.5 0.7 0.7 0.8 0.8 0.5 0.4 0.3 0.9 0.9 0.1 0.4 0.2 1 0.4 1 0.8 0.8 0.6 0.2 0.7 0.8 0.7 0.5 0.1 0.7 0.5 0.1 0.7 0.9 0.3 0.5 0.9 0.4 0.6 0.3 0.3 0.7 0.7'

Output argument "y" (and maybe others) not assigned during call to "find_max_sigdec". Error in Test2 (line 6) assert(isequal(find_max_sigdec(x), N))

3   Fail
N = randi(6,1); a = rand(5,20); for k = 1:20 for m = 1:5 x(m,k) = round(a(m,k)*10^N)/10^N; end end assert(isequal(find_max_sigdec(x), N))

a = 5×236 char array ' 0.26799 0.47606 0.73081 0.086379 0.01096 0.26329 0.74749 0.4525 0.17025 0.83446 0.97738 0.85946 0.34245 0.61742 0.54951 0.38279 0.52226 0.40027 0.90036 0.92538' ' 0.68517 0.65112 0.60081 0.12683 0.50332 0.23969 0.61333 0.65221 0.90559 0.10386 0.77494 0.85038 0.54011 0.96542 0.095422 0.60443 0.8525 0.7671 0.15114 0.67307' ' 0.82652 0.23381 0.62459 0.58623 0.39984 0.85943 0.58731 0.30607 0.42499 0.20604 0.30105 0.74346 0.031368 0.69618 0.56896 0.74781 0.60859 0.35491 0.84305 0.51849' '0.094451 0.84923 0.11851 0.42318 0.88496 0.71701 0.49412 0.66391 0.74973 0.46864 0.68933 0.23833 0.05539 0.4387 0.23566 0.50435 0.74537 0.51709 0.35632 0.16436' ' 0.23685 0.14556 0.93206 0.62305 0.65493 0.73541 0.28515 0.14182 0.022024 0.89802 0.48058 0.19475 0.49711 0.66883 0.6626 0.76762 0.8796 0.3702 0.96686 0.39847'

Output argument "y" (and maybe others) not assigned during call to "find_max_sigdec". Error in Test3 (line 8) assert(isequal(find_max_sigdec(x), N))

4   Fail
x = 1; assert(isequal(find_max_sigdec(x), 0))

a = '1'

Output argument "y" (and maybe others) not assigned during call to "find_max_sigdec". Error in Test4 (line 2) assert(isequal(find_max_sigdec(x), 0))