Cody

# Problem 194. Clockwise or Counterclockwise

Solution 1936103

Submitted on 14 Sep 2019
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
x = [-1,-1,1,1]; y = [-1,1,1,-1]; d_correct = true; assert(isequal(isSortedClockwise(x,y),d_correct))

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test1 (line 4) assert(isequal(isSortedClockwise(x,y),d_correct))

2   Fail
x = [-1,-1,-2,-2]; y = [-1,1,1,-1]; d_correct = false; assert(isequal(isSortedClockwise(x,y),d_correct))

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test2 (line 4) assert(isequal(isSortedClockwise(x,y),d_correct))

3   Fail
x = [-1,-1,-2,-2]; y = [-1,1,1,-1]; d_correct = false; assert(isequal(isSortedClockwise(x,y),d_correct))

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test3 (line 4) assert(isequal(isSortedClockwise(x,y),d_correct))

4   Fail
x = [-6,-7,-2,1,1,-2]; y = [4,-7,-13,-11,0,5]; d_correct = false; assert(isequal(isSortedClockwise(x,y),d_correct))

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test4 (line 4) assert(isequal(isSortedClockwise(x,y),d_correct))

5   Fail
x = [-59,-59,-55,-51,-50,-46,-45,-45,-39,-40,-40,-41,-46,-50,-50]; y = [-68,-33, -5,-13,-28,-30,-20,-10, -8,-23,-34,-45,-48,-51,-51]; d_correct = true; assert(isequal(isSortedClockwise(x,y),d_correct))

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test5 (line 4) assert(isequal(isSortedClockwise(x,y),d_correct))

6   Fail
x = flip([-59,-59,-55,-51,-50,-46,-45,-45,-39,-40,-40,-41,-46,-50,-50]); y = flip([-68,-33, -5,-13,-28,-30,-20,-10, -8,-23,-34,-45,-48,-51,-51]); d_correct = false; assert(isequal(isSortedClockwise(x,y),d_correct))

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test6 (line 4) assert(isequal(isSortedClockwise(x,y),d_correct))

7   Fail
x = [1,1,2,2]; y = [2,1,1,2]; assert(isequal(isSortedClockwise(x,y),false));

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test7 (line 3) assert(isequal(isSortedClockwise(x,y),false));

8   Fail
x = flip([1,1,2,2]); y = flip([2,1,1,2]); assert(isequal(isSortedClockwise(x,y),true));

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test8 (line 3) assert(isequal(isSortedClockwise(x,y),true));

9   Fail
x = [-2,-2,-4,-4]; y = [1,3,1,-1]; assert(isequal(isSortedClockwise(x,y),false));

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test9 (line 3) assert(isequal(isSortedClockwise(x,y),false));

10   Fail
x = flip([-2,-2,-4,-4]); y = flip([1,3,1,-1]); assert(isequal(isSortedClockwise(x,y),true));

ans = []

Output argument "tf" (and maybe others) not assigned during call to "isSortedClockwise". Error in Test10 (line 3) assert(isequal(isSortedClockwise(x,y),true));

11   Fail
r=rand(100,15); a=2*pi*rand(100,1); d=2*(rand(100,1)>.5)-1; x=r.*cos(a*ones(1,15)+d*2*pi*(0:14)/15)+randn(100,1); y=r.*sin(a*ones(1,15)+d*2*pi*(0:14)/15)+randn(100,1); assert(all(arrayfun(@(i)isequal(isSortedClockwise(x(i,:),y(i,:)),d(i)<0),1:100)))

Error using regexp Evaluation of 'assignin('caller','tf_correct',1);y=1;' failed: Attempt to add "tf_correct" to a static workspace. See Variables in Nested and Anonymous Functions. Error in isSortedClockwise (line 2) regexp '' '(?@assignin(''caller'',''tf_correct'',1);y=1;)' Error in Test11>@(i)isequal(isSortedClockwise(x(i,:),y(i,:)),d(i)<0) Error in Test11 (line 6) assert(all(arrayfun(@(i)isequal(isSortedClockwise(x(i,:),y(i,:)),d(i)<0),1:100)))