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

Learn moreOpportunities for recent engineering grads.

Apply TodaySuppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4, and 6 to 4 is 2. Total distance traveled = 3 + 4 + 2 = 9.

Example:

Input x = [1 2 3 2] Output y is 3

1156 correct solutions
585 incorrect solutions

Last solution submitted on Jan 26, 2015

7 players like this problem

1 Comment

SAMET YILDIZ
on 15 Jul 2014

What is the problem with this solution? It works on matlab

1 Comment

Marios
on 19 Feb 2014

sumabs()

9 Comments