Cody

Problem 1957. Check if equal

Solution 2053353

Submitted on 10 Dec 2019 by Maklári-Klekner Tamás Pál
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 = 5*ones(2,3); y_correct = logical(1); assert(isequal(checkIfequal(x),y_correct))

k = 0 y = logical 1

2   Pass
x = magic(4); y_correct = logical(0); assert(isequal(checkIfequal(x),y_correct))

k = 120 y = logical 0

3   Pass
x = zeros(4,4,4); y_correct = logical(1); assert(isequal(checkIfequal(x),y_correct))

k(:,:,1) = 0 k(:,:,2) = 0 k(:,:,3) = 0 k(:,:,4) = 0 y = logical 1

4   Pass
x = randn(3,3,3,3); y_correct = logical(0); assert(isequal(checkIfequal(x),y_correct))

k(:,:,1,1) = -0.9425 k(:,:,2,1) = -0.9749 k(:,:,3,1) = -0.5659 k(:,:,1,2) = -0.6321 k(:,:,2,2) = -0.7873 k(:,:,3,2) = -0.9281 k(:,:,1,3) = -0.7952 k(:,:,2,3) = -0.7310 k(:,:,3,3) = -0.7589 y = logical 0