title: calculating shortest grid distance
body: <blockquote>
  <p>Consider a city where the streets are perfectly laid out to form an infinite square grid. In this city finding the shortest path between two given points (an origin and a destination) is much easier than in other more complex cities. As a new Uber developer, you are tasked to create an algorithm that does this calculation.</p>
  <p>Given user's departure and destination coordinates, each of them located on some street, find the length of the shortest route between them assuming that cars can only move along the streets. You are guaranteed that at least one of the coordinates is an integer.</p>
  </blockquote>
  <p>I am struggling a little to figure out the logic here. There are many cases and I don't know how to accommodate them all. This is what I have so far</p>
  <pre><code>double perfectCity(double[] departure, double[] destination) {
      double yDist = Math.abs(destination[1]-departure[1]);
      double xDist = Math.abs(departure[1] - departure[0] + departure[1]-destination[0]);
      return xDist + yDist;
  }
  </code></pre>