Problem 44408. ゼロでない要素が一番多い行を探そう
行列 a が与えられたとき、行列 a の中で一番ゼロの要素が少ない行のインデクス r を返す関数を作成しましょう。このとき、行列 a には一つだけしかこの条件に当てはまる行がないと仮定します。
例:
入力として、行列
a = [ 1 2 0 0 0
0 0 5 0 0
2 7 0 0 0
0 6 9 3 3 ]
が与えられたとき、出力 r は 4 を返します。- (英語版) Problem 32. Most nonzero elements in row https://www.mathworks.com/matlabcentral/cody/problems/32
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers337
Suggested Problems
-
Numbers with prime factors 2, 3 and 5.
679 Solvers
-
Try 1.5.4: Celsius to Fahrenheit
858 Solvers
-
526 Solvers
-
Test Problem; Create a 5x5 array containing all ones
402 Solvers
-
Double all elements in the array
2119 Solvers
More from this Author12
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!