Cody

Solution 847108

Submitted on 8 Mar 2016
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
N=2; Q=5; m=MaxNonCoplanarPts(N,Q); m=floor(abs(m)) % Perform m check valid=1; if size(m,1)<Q,valid=0;end % Must be Q pts or more if max(m(:))>N-1,valid=0;end pset=nchoosek(1:size(m,1),4); for i=1:length(pset) m4=m(pset(i,:),:); % Coplanar check method courtesy of Tim if ~det([m4 ones(4,1)]) % coplanar det=0 valid=0; break end end assert(isequal(1,valid))

m = 0 0 0 0 0 1 0 1 0 1 0 0 1 1 1

2   Fail
N=3; Q=8; m=MaxNonCoplanarPts(N,Q); m=floor(abs(m)) % Perform m check valid=1; if size(m,1)<Q,valid=0;end % Must be Q pts or more if max(m(:))>N-1,valid=0;end pset=nchoosek(1:size(m,1),4); for i=1:length(pset) m4=m(pset(i,:),:); % Coplanar check method courtesy of Tim if ~det([m4 ones(4,1)]) % coplanar det=0 valid=0; break end end assert(isequal(1,valid))

m = 0 0 0 0 0 1 0 1 0 1 0 0 1 1 0 1 1 1 1 1 2 1 2 0

Assertion failed.