Cody

# Problem 691. Number of bytes required to store a sparse matrix

Solution 497061

Submitted on 7 Sep 2014
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   Fail
% I have rescored solutions , somme asserts were missing in the test suite

Error: You may not use the command(s) evalc in your code

2   Fail
%% x = sparse(100,1000,0.01); y_correct = 4016; assert(isequal(your_fcn_name(x),y_correct))

Error: You may not use the command(s) evalc in your code

3   Fail
%% x = sparse(10000,10000,pi); y_correct = 40016 assert(isequal(your_fcn_name(x),y_correct))

Error: You may not use the command(s) evalc in your code

4   Fail
%% x = sparse(10,15); y_correct = 76 assert(isequal(your_fcn_name(x),y_correct))

Error: You may not use the command(s) evalc in your code

5   Fail
%% B = [ 41 11 0 52 22 0 63 33 13 74 44 24 ]; d = [-3 0 2]; x = spdiags(B,d,7,4) y_correct = 140 assert(isequal(your_fcn_name(x),y_correct))

Error: You may not use the command(s) evalc in your code

6   Fail
%% Random sparse matrix (harder) %x=sprand(100,1000,0.01); %z = whos('x') %y_correct = round(z.bytes) %your_sol = round(your_fcn_name(x)) %assert(isequal(round(your_fcn_name(x)),y_correct))

Error: You may not use the command(s) evalc in your code

7   Fail
%% Prevents cheating filetext = fileread('your_fcn_name.m') assert(isempty(strfind(filetext, 'whos'))) assert(isempty(strfind(filetext, 'who')))

Error: You may not use the command(s) evalc in your code