Credits
Inspired by CodeWars
Manhattan Distance
Manhattan distance is the distance between two points in a grid (like the grid-like street geography of the New York borough of Manhattan) calculated by only taking a vertical and/or horizontal path.
Write a function int manhattanDistance(Point, Point)
that returns the Manhattan Distance between the two points.
Rules
- The class
Point
is immutable (its state cannot be changed after instantiation) - The class
Point
has no Getters - The class
Point
has no public properties (i.e. the internal state cannot be read from outside the class).
Starting Points
Clojure, CoffeeScript, C++, C#, Erlang, Groovy, Intercal, Java, JavaScript, Lisp, PHP, Ruby, Scala
Image credits
Image by Egga. It shows an exemplary flip chart to facilitate the kata.