Cody

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

Solution 92183

Submitted on 24 May 2012 by James
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))

x_str = 1. x_str = 2.05. x_str = 5.0001. x_str = 1.04. x_str = 2.33. x_str = 6.429. x_str = 0.22. x_str = 4.1. x_str = 7.492. x_str = 10.1. x_str = 1000.31. x_str = 8.

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

x_str = 0.65. x_str = 0.07. x_str = 0.41. x_str = 0.67. x_str = 0.93. x_str = 0.81. x_str = 0.48. x_str = 0.76. x_str = 0.42. x_str = 0.97. x_str = 0.99. x_str = 0.86. x_str = 0.39. x_str = 0.45. x_str = 0.25. x_str = 0.78. x_str = 0.88. x_str = 0.91. x_str = 0.56. x_str = 0.6. x_str = 0.15. x_str = 0.9. x_str = 0.45. x_str = 0.21. x_str = 0.9. x_str = 0.76. x_str = 0.88. x_str = 0.28. x_str = 0.67. x_str = 0.66. x_str = 0.12. x_str = 0.41. x_str = 0.28. x_str = 0.72. x_str = 0.28. x_str = 0.9. x_str = 0.83. x_str = 0.39. x_str = 0.5. x_str = 0.69. x_str = 0.83. x_str = 0.61. x_str = 0.57. x_str = 0.33. x_str = 0.46. x_str = 0.71. x_str = 0.88. x_str = 0.72. x_str = 0.02. x_str = 0.67. x_str = 0.44. x_str = 0.44. x_str = 0.12. x_str = 0.81. x_str = 0.32. x_str = 0.25. x_str = 0.34. x_str = 0.38. x_str = 0.55. x_str = 0.56. x_str = 0.4. x_str = 0.4. x_str = 0.52. x_str = 0.66. x_str = 0.95. x_str = 0.72. x_str = 0.4. x_str = 0.83. x_str = 0.13. x_str = 0.06. x_str = 0.08. x_str = 0.16. x_str = 0.32. x_str = 0.3. x_str = 0.01. x_str = 0.54. x_str = 0.1. x_str = 0.15. x_str = 0.63. x_str = 0.86. x_str = 0.97. x_str = 0.57. x_str = 1. x_str = 0.55. x_str = 0.52. x_str = 0.33. x_str = 0.43. x_str = 0.49. x_str = 0.07. x_str = 0.89. x_str = 0.06. x_str = 0.44. x_str = 0.83. x_str = 0.39. x_str = 0.61. x_str = 0.82. x_str = 0.89. x_str = 0.93. x_str = 0.19. x_str = 0.26.

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

x_str = 0.593362. x_str = 0.50384. x_str = 0.61281. x_str = 0.819422. x_str = 0.531889. x_str = 0.202075. x_str = 0.453893. x_str = 0.427911. x_str = 0.966053. x_str = 0.620055. x_str = 0.69539. x_str = 0.720165. x_str = 0.346895. x_str = 0.51699. x_str = 0.556695. x_str = 0.156495. x_str = 0.562056. x_str = 0.694803. x_str = 0.426456. x_str = 0.83627. x_str = 0.731387. x_str = 0.360031. x_str = 0.454212. x_str = 0.38639. x_str = 0.775555. x_str = 0.734271. x_str = 0.430278. x_str = 0.693753. x_str = 0.945213. x_str = 0.784233. x_str = 0.705572. x_str = 0.109334. x_str = 0.389931. x_str = 0.590905. x_str = 0.45938. x_str = 0.05034. x_str = 0.228688. x_str = 0.834189. x_str = 0.015645. x_str = 0.863711. x_str = 0.078069. x_str = 0.669043. x_str = 0.500211. x_str = 0.217994. x_str = 0.571616. x_str = 0.122189. x_str = 0.671166. x_str = 0.599586. x_str = 0.055976. x_str = 0.056343. x_str = 0.152501. x_str = 0.019621. x_str = 0.435176. x_str = 0.832221. x_str = 0.61739. x_str = 0.520129. x_str = 0.863868. x_str = 0.097698. x_str = 0.908052. x_str = 0.108017. x_str = 0.516997. x_str = 0.143156. x_str = 0.559371. x_str = 0.00458. x_str = 0.766682. x_str = 0.848709. x_str = 0.916821. x_str = 0.986968. x_str = 0.505133. x_str = 0.271422. x_str = 0.100751. x_str = 0.507849. x_str = 0.585609. x_str = 0.762887. x_str = 0.082963. x_str = 0.661596. x_str = 0.516979. x_str = 0.171048. x_str = 0.938558. x_str = 0.590483. x_str = 0.440635. x_str = 0.941919. x_str = 0.655914. x_str = 0.451946. x_str = 0.839697. x_str = 0.532624. x_str = 0.553887. x_str = 0.680066. x_str = 0.36719. x_str = 0.239291. x_str = 0.578923. x_str = 0.866887. x_str = 0.406777. x_str = 0.112615. x_str = 0.443846. x_str = 0.300184. x_str = 0.401387. x_str = 0.833364. x_str = 0.403629. x_str = 0.390176.

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

x_str = 1.