Cody

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

Solution 3216043

Submitted on 15 Oct 2020 by Jeong Suong Yang
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   Pass
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))

k = 1×0 empty char array k = '05' k = '0001' k = '04'

2   Pass
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))

k = '42227' k = '02039' k = '75016' k = '78492' k = '92267' k = '26357' k = '71513' k = '35801' k = '8967' k = '34533' k = '45098' k = '16105' k = '1103' k = '30429' k = '37965' k = '98486' k = '44192' k = '67625' k = '61174' k = '11726' k = '01389' k = '2316' k = '95102' k = '6169' k = '24701' k = '68199' k = '23659' k = '9107' k = '23576' k = '74716' k = '69873' k = '78046' k = '43917' k = '86782' k = '15419' k = '72419' k = '697' k = '32208' k = '1007' k = '62126' k = '49809' k = '11444' k = '89205' k = '23519' k = '89004' k = '8423' k = '83453' k = '27283' k = '10422' k = '61868' k = '64933' k = '18088' k = '00873' k = '83575' k = '10279' k = '37235' k = '93246' k = '1485' k = '53459' k = '28895' k = '94994' k = '69097' k = '9766' k = '11789' k = '02805' k = '39619' k = '51488' k = '16462' k = '10181' k = '46743' k = '31441' k = '1927' k = '15821' k = '21813' k = '78349' k = '01562' k = '56074' k = '35923' k = '8743' k = '89816' k = '71022' k = '75694' k = '42389' k = '899' k = '67657' k = '40119' k = '50829' k = '21494' k = '20579' k = '26539' k = '20017' k = '44923' k = '27093' k = '98339' k = '50669' k = '70894' k = '04939' k = '83417' k = '14247' k = '74743'

3   Pass
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))

k = '14799' k = '50272' k = '10539' k = '75374' k = '97092' k = '051961' k = '20796' k = '030574' k = '42466' k = '33909' k = '42475' k = '36163' k = '38549' k = '74694' k = '73557' k = '31284' k = '51221' k = '34416' k = '17478' k = '63653'

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

k = 1×0 empty char array

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!