Map Distance (Structs & Classes)

Define a Point type. Read two points x1 y1 x2 y2 and print the Manhattan distance |x1−x2| + |y1−y2|.

Input: Four integers.

Output: The distance.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Write a method or function that takes two Points.

More Structs & Classes practice