It is useful to mention sort in 'descending' order of distance from origin.
hey
great problem!!!!
nice
Wow, I didn't think this would actually work.
Writing a solution whose size is so close to Leading solution is such a happy thing.
which leading solutions size is always 7 :S
Interesting. If you leave the 'ComparisonMethod','abs' it's still correct (size is 13).
Though, I believe this is the shortest, universally correct solution.
I keep receiving 'Matrix dimensions must agree' when using c(c==-d)... it seems to work fine in matlab, but not on here. Any ideas?
Note that "c(c==-d) = d" means that c and d must be same size or d is scalar. Moreover if d is not a scalar, then all "c==-d" must be true. This code seems to work in rare case, when one value is negative real number, and the rest are positive real numbers, but I have not tested it.
This is like the 'War & Peace' solution. I like it!
where is the problem here? it works on matlab
The function has to be named "complexSort".
Thanks for sharing
Simple and elegant, i like it
i keep learning new features...
2489 Solvers
608 Solvers
219 Solvers
485 Solvers
Calculate Amount of Cake Frosting
7686 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!