Cody

Solution 1057550

Submitted on 21 Nov 2016 by Zikobrelli
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 = 0; z_correct = 1; assert(isequal(lastzerorow(a),z_correct))

z = 1

2   Pass
a = 1; z_correct = 0; assert(isequal(lastzerorow(a),z_correct))

3   Pass
a = randi(1000,1000,1); z_correct = 0; assert(isequal(lastzerorow(a),z_correct))

4   Pass
a = [0;1;0;2;0;3;0;4;0;5;0;6;0;7;0;8;0;9;0;10]; z_correct = 19; assert(isequal(lastzerorow(a),z_correct))

z = 19

5   Pass
n = randi(1000); a = tril(ones(n)); z_correct = 0:n-1; assert(isequal(lastzerorow(a),z_correct))

z = Columns 1 through 16 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 113 through 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 129 through 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 145 through 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 161 through 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 177 through 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 193 through 208 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 209 through 224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 225 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 257 through 272 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 273 through 288 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 289 through 304 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 305 through 320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 321 through 336 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 337 through 352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 353 through 361 0 0 0 0 0 0 0 0 0 z = Columns 1 through 16 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 113 through 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 129 through 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 145 through 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 161 through 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 177 through 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 193 through 208 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 209 through 224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 225 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 257 through 272 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 273 through 288 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 289 through 304 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 305 through 320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 321 through 336 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 337 through 352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 353 through 361 0 0 0 0 0 0 0 0 0 z = Columns 1 through 16 0 1 2 3 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 113 through 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 129 through 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 145 through 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 161 through 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 177 through 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 193 through 208 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 209 through 224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 225 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 257 through 272 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 273 through 288 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 289 through 304 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 305 through 320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 321 through 336 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 337 through 352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 353 through 361 0 0 0 0 0 0 0 0 0 z = Columns 1 through 16 0 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 113 through 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 129 through 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 145 through 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 161 through 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 177 through 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 193 through 208 0 ...

6   Pass
n = randi(1000); a = tril(ones(n),-1); z_correct = 1:n; assert(isequal(lastzerorow(a),z_correct))

z = Columns 1 through 16 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 113 through 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 129 through 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 145 through 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 161 through 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 177 through 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 193 through 208 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 209 through 224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 225 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 257 through 272 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 273 through 288 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 289 through 304 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 305 through 320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 321 through 336 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 337 through 352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 353 through 368 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 369 through 384 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 385 through 400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 401 through 416 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 417 through 432 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 433 through 448 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 449 through 464 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 465 through 480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 481 through 496 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 497 through 512 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 513 through 528 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 529 through 544 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 545 through 560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 561 through 576 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 577 through 592 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 593 through 608 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 609 through 624 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 625 through 640 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 641 through 656 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 657 through 672 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 673 through 688 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 689 through 704 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 705 through 720 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 721 through 736 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 737 through 752 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 753 through 768 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 769 through 784 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 785 through 800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 801 through 816 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 817 through 829 0 0 0 0 0 0 0 0 0 0 0 0 0 z = Columns 1 through 16 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 113 through 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 129 through 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 145 through 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 161 through 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 177 through 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 193 through 208 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 209 through 224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 225 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 257 through 272 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 273 through 288 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 289 through 304 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 305 through 320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 321 through 336 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 337 through 352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 353 through 368 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 369 through 384 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 385 through 400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 401 through 416 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 417 through 432 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 433 through 448 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 449 through 464 0 ...

7   Pass
n = randi(1000); d = randi(n-1); a = tril(ones(n),-d); z_correct = min((0:n-1)+d,n); assert(isequal(lastzerorow(a),z_correct))

z = Columns 1 through 16 172 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 113 through 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 129 through 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 145 through 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 161 through 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 177 through 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 193 through 208 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 209 through 224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 225 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 257 through 272 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 273 through 288 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 289 through 304 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 305 through 320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 321 through 336 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 337 through 352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 353 through 368 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 369 through 384 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 385 through 400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 401 through 416 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 417 through 432 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 433 through 448 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 449 through 464 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 465 through 480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 481 through 496 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 497 through 512 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 513 through 528 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 529 through 544 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 545 through 560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 561 through 576 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 577 through 592 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Column 593 0 z = Columns 1 through 16 172 173 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 112 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 113 through 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 129 through 144 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 145 through 160 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 161 through 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 177 through 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 193 through 208 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 209 through 224 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 225 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 257 through 272 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 273 through 288 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 289 through 304 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 305 through 320 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 321 through 336 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 337 through 352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 353 through 368 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 369 through 384 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 385 through 400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 401 through 416 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 417 through 432 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 433 through 448 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 449 through 464 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 465 through 480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 481 through 496 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 497 through 512 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 513 through 528 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 529 through 544 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 545 through 560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 561 through 576 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 577 through 592 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Column 593 0 z = Columns 1 through 16 172 173 174 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0...

8   Pass
a = magic(10)-1; z_correct = [0 0 1 0 0 0 0 0 0 0]; assert(isequal(lastzerorow(a),z_correct))

z = 0 0 1 0 0 0 0 0 0 0

9   Pass
a = [0 0 9 0; 0 0 1 8; 0 0 4 0; 0 0 2 3; 0 6 7 5]; z_correct = [5 4 0 3]; assert(isequal(lastzerorow(a),z_correct))

z = 5 0 0 0 z = 5 4 0 0 z = 5 4 0 3

10   Pass
a = [0 0 0 0 -4 0 0 0 0; 0 0 0 -3 -3 -3 0 0 0; 0 0 -2 3 -2 2 2 0 0; 0 -1 2 -1 1 -1 -1 1 0]; z_correct = [4 3 2 1 0 1 2 3 4]; assert(isequal(lastzerorow(a),z_correct))

z = 4 0 0 0 0 0 0 0 0 z = 4 3 0 0 0 0 0 0 0 z = 4 3 2 0 0 0 0 0 0 z = 4 3 2 1 0 0 0 0 0 z = 4 3 2 1 0 1 0 0 0 z = 4 3 2 1 0 1 2 0 0 z = 4 3 2 1 0 1 2 3 0 z = 4 3 2 1 0 1 2 3 4