I dont get whay sort(unique(ix)) will give you the location of the two points. it is wrong for these points (0.9631 0.5468),(0.5211 0.2316),(0.4889,0.6241),(0.6791 0.3955),(0.3670 0.9890),
sort(unique(ix)) will return [1 2 5].
I think this solution is not right
I agree.
there may be something out of word,
if i put:
p =[1 0; 0 1;0 0; 1/sqrt(2) 1/sqrt(2) ]
your command would not right,
but 'unique' is very admirable.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
p = [0 0;
1 0;
2 2;
0 1];
ix_correct = [1 3];
assert(isequal(mostDistant(p),ix_correct))
|
2 | Pass |
%%
p = [0 0;
1 0;
2 2;
0 10];
ix_correct = [2 4];
assert(isequal(mostDistant(p),ix_correct))
|
3 | Pass |
%%
p = [0 0;
-1 50];
ix_correct = [1 2];
assert(isequal(mostDistant(p),ix_correct))
|
4 | Pass |
%%
p = [5 5;
1 0;
2 2;
0 10;
-100 20;
1000 400];
ix_correct = [5 6];
assert(isequal(mostDistant(p),ix_correct))
|
Project Euler: Problem 1, Multiples of 3 and 5
1491 Solvers
Find the largest value in the 3D matrix
1056 Solvers
965 Solvers
232 Solvers
485 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!