Cody

Problem 1074. Property dispute!

Solution 2215281

Submitted on 16 Apr 2020
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 0 5 10]; b = [3 2 6 6]; c = [3 2 2 6]; assert(isequal(disputed_region(a,b),c))

shape = 3 2 3 8 5 8 5 2 C = 3 2 2 6

  
2   Fail
a = [0 1 2 3]; b = [-1 2 4 5]; c = [0 2 2 2]; assert(isequal(disputed_region(a,b),c))

shape = 0 4 2 4 2 2 0 2 C = 0 4 2 0

Assertion failed.

  
3   Fail
a = [3 4 6 1]; b = [2 1 2 2]; c = []; assert(isequal(disputed_region(a,b),c))

shape = 0×2 empty double matrix

Index exceeds the number of array elements (0). Error in disputed_region (line 23) C=[shape(1) shape(5) shape(3)-shape(1) shape(7)-shape(8)] Error in Test3 (line 4) assert(isequal(disputed_region(a,b),c))

  
4   Fail
a = [5 18 14 6]; b = [11 23 17 18]; c = [11 23 8 1]; assert(isequal(disputed_region(a,b),c))

shape = 19 24 19 23 11 23 11 24 C = 19 24 -8 -1

Assertion failed.

  
5   Pass
a = [100 97 3 2]; b = [99 93 12 12]; c = [100 97 3 2]; assert(isequal(disputed_region(a,b),c))

shape = 100 97 100 99 103 99 103 97 C = 100 97 3 2

  
6   Pass
delta = 0.5; a = [0 0 5 10]+delta; b = [3 2 6 6]+delta; c = [3 2 2 6]+delta; assert(isequal(disputed_region(a,b),c))

shape = 3.5000 2.5000 3.5000 9.0000 6.0000 9.0000 6.0000 2.5000 C = 3.5000 2.5000 2.5000 6.5000

  
7   Fail
a = [0 0 1 1]; b = [2 2 1 1]; c = []; assert(isequal(disputed_region(a,b),c))

shape = 0×2 empty double matrix

Index exceeds the number of array elements (0). Error in disputed_region (line 23) C=[shape(1) shape(5) shape(3)-shape(1) shape(7)-shape(8)] Error in Test7 (line 4) assert(isequal(disputed_region(a,b),c))

  

Suggested Problems

More from this Author50

Community Treasure Hunt

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

Start Hunting!