Cody

Problem 32. Most nonzero elements in row

Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row that matches this criterion.

Example:

 Input  a = [ 1 2 0 0 0
              0 0 5 0 0 
              2 7 0 0 0
              0 6 9 3 3 ]
 Output r is 4

Solution Stats

42.45% Correct | 57.55% Incorrect
Last solution submitted on Oct 22, 2017

Problem Comments

Solution Comments

Tags

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!