Cody

# Problem 32. Most nonzero elements in row

Solution 94600

Submitted on 1 Jun 2012 by David Smith
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
%% a = [ ... 1 2 0 0 0 0 0 5 0 0 2 7 0 0 0 0 6 9 3 3]; r_correct = 4; assert(isequal(fullest_row(a),r_correct))

t_rows = 4 t_cols = 5 t_non_zero = 2 max_num = 2 t_non_zero = 1 t_non_zero = 2 t_non_zero = 4 max_num = 4

2   Pass
%% a = [ ... 1 2 0 0 0 0 5 0 0 6 9 -3 2 7 0 0 0 0 0 0]; r_correct = 3; assert(isequal(fullest_row(a),r_correct))

t_rows = 5 t_cols = 4 t_non_zero = 2 max_num = 2 t_non_zero = 1 t_non_zero = 3 max_num = 3 t_non_zero = 2 t_non_zero = 0

3   Pass
%% a = [ ... 1 0 0 0 0 0 0 0 0 0 0 0 0 2 3]; r_correct = 5; assert(isequal(fullest_row(a),r_correct))

t_rows = 5 t_cols = 3 t_non_zero = 1 max_num = 1 t_non_zero = 0 t_non_zero = 0 t_non_zero = 0 t_non_zero = 2 max_num = 2

4   Pass
%% a = [ ... 0 0 0 -3 0 0]; r_correct = 4; assert(isequal(fullest_row(a),r_correct))

t_rows = 6 t_cols = 1 t_non_zero = 0 t_non_zero = 0 t_non_zero = 0 t_non_zero = 1 max_num = 1 t_non_zero = 0 t_non_zero = 0