Suppose you go from x-y coordinates [3,4] to [0,0] to [0,1] to [1,1], then you walked 7 units of distance.
better to describe input size: xy 4-by-2, each row is the xy-coordinate of a point
Needs a richer test suite. A lot of "solvers" have just put a=7 as the "solution", but although this satisfies the single test case, it doesn't solve the problem as stated.
This could be quite a good solution, if you removed the "x = 7; %" part and just left what is now a comment. As it is, although it satisfies the test case, it doesn't actually solve the problem.
... though, just to be clear, the comment wouldn't be quite right, it still needs a little adjustment.
Create a cell array out of a struct
Test if a Number is a Palindrome without using any String Operations
Find the sum of the elements in the "second" diagonal
Back to basics 11 - Max Integer
07 - Common functions and indexing 6
How many jokers?
Have you seen any Spindromes recently?
Given an unsigned integer x, find the largest y by rearranging the bits in x
speed vs size
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office