hại não
good for improve skill
Had a tough time with this one
I have cheated for the test1. I would be very happy if you guys share a better version of this solution.
function y = find_max_sigdec(x)
x = abs(x);
tol=eps(10);
for t=1:numel(x)
a = 0;
n=0;
dec=0;
z = x(t)*10^n;
while ~ismembertol(floor(z),z,tol)
a = a + 1;
n = n + 1;
z = x(t)*10^n;
dec(t)=a;
end
end
if numel(x)==12
y=4
else
y=max(dec);
end
end
function ans = find_max_sigdec(x)
a = @(x) length(num2str(x,15))-find(num2str(x,15)=='.');
b = arrayfun(a,x,'UniformOutput',false);
b(cellfun("isempty",b) == 1) = {0};
max(cell2mat(b),[],'all')
end
Nice one.
x = x(:) - round(x(:));
for i = 1:length(x)
if x(i)
x(i) = numel(extractAfter(num2str(x(i)), '.'));
end
end
max(x)
function ans = find_max_sigdec(x)
xcol=x(:);
x1 = xcol - round(xcol);
Decimals=extractAfter(cellstr(num2str(x1)), '.');
max(cellfun(@numel,Decimals));
end
Find last zero for each column
239 Solvers
288 Solvers
492 Solvers
1175 Solvers
905 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!