Cody

Problem 30. Sort a list of complex numbers based on far they are from the origin.

Created by Cody Team in Cody Challenge

Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear first.

So if z is

 z = [-4 6 3+4i 1+i 0]

then the output zSorted would be

 zSorted = [6 3+4i -4 1+i 0]

Solution Stats

53.8% Correct | 46.2% Incorrect
Last solution submitted on Feb 21, 2018

Problem Comments

Solution Comments

Recent Solvers2849

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!