Cody

Problem 159. Figurate number triangle

Solution 2768956

Submitted on 2 Aug 2020 by Ramesh Kumar V
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
x = [1 0; 1 1]; y_correct = true; assert(isequal(fnt(x),y_correct))

m = 2 n = 2 y = 0 0 0 0 a = 1 a = 1 1 a = 1 0 1 1 y = logical 1

2   Pass
x = [1 0 0; 1 1 0; 1 2 1]; y_correct = true; assert(isequal(fnt(x),y_correct))

m = 3 n = 3 y = 0 0 0 0 0 0 0 0 0 a = 1 a = 1 1 a = 1 0 1 1 a = 1 0 1 1 1 0 a = 1 0 1 1 1 2 a = 1 0 0 1 1 0 1 2 1 y = logical 1

3   Pass
x = [1 0 0 0; 1 1 0 0; 1 2 1 0; 1 3 3 1]; y_correct = true; assert(isequal(fnt(x),y_correct))

m = 4 n = 4 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a = 1 a = 1 1 a = 1 0 1 1 a = 1 0 1 1 1 0 a = 1 0 1 1 1 2 a = 1 0 0 1 1 0 1 2 1 a = 1 0 0 1 1 0 1 2 1 1 0 0 a = 1 0 0 1 1 0 1 2 1 1 3 0 a = 1 0 0 1 1 0 1 2 1 1 3 3 a = 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1 y = logical 1

4   Pass
x = [1 0 1; 1 1 0; 1 2 1]; y_correct = false; assert(isequal(fnt(x),y_correct))

m = 3 n = 3 y = 0 0 0 0 0 0 0 0 0 a = 1 a = 1 1 a = 1 0 1 1 a = 1 0 1 1 1 0 a = 1 0 1 1 1 2 a = 1 0 0 1 1 0 1 2 1 y = logical 0

5   Pass
x = zeros(5); y_correct = false; assert(isequal(fnt(x),y_correct))

m = 5 n = 5 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a = 1 a = 1 1 a = 1 0 1 1 a = 1 0 1 1 1 0 a = 1 0 1 1 1 2 a = 1 0 0 1 1 0 1 2 1 a = 1 0 0 1 1 0 1 2 1 1 0 0 a = 1 0 0 1 1 0 1 2 1 1 3 0 a = 1 0 0 1 1 0 1 2 1 1 3 3 a = 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1 a = 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1 1 0 0 0 a = 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1 1 4 0 0 a = 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1 1 4 6 0 a = 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1 1 4 6 4 a = 1 0 0 0 0 1 1 0 0 0 1 2 1 0 0 1 3 3 1 0 1 4 6 4 1 y = logical 0

Suggested Problems

More from this Author23

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!