Created
August 7, 2019 22:34
-
-
Save derrickp/98c858142aa0bbeb1fc422253ed1d9a0 to your computer and use it in GitHub Desktop.
Manhattan distance values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
| |
/* | |
* We live in a simplified version of Manhattan | |
* | |
* Our roads are on a grid where we have the following: | |
* - 225 streets running East - West | |
* - 11 avenues running North - South | |
* | |
* We work on a mapping application that is designed to assist our users | |
* in finding the nearest subway station to them. | |
* | |
* Given the location of stations listed below, I want to be able to tell | |
* one of our users which station or stations are closest to them. | |
* | |
* Since our customers are human and will be walking, we can calculate the | |
* distance between them and their subway station by using | |
* "Manhattan Distance" | |
* | |
* Manhattan Distance is defined as the number of blocks something is away. | |
* For Example: | |
* 21st Street is 3 blocks away from 24th Street | |
* 5th Avenue is 2 blocks way from 3rd Avenue | |
* Therefore: 21st & 5th is 5 blocks away from 24th & 3rd | |
* | |
* All inputs and return values can be in formats of your choosing. | |
* | |
* The program should tell the customer which station(s) are the closest | |
* to them, and how far they are away | |
* | |
* To execute Java, please define "static void main" on a class | |
* named Solution. | |
* | |
* If you need more classes, simply define them inline. | |
*/ | |
| |
class Solution { | |
public static void main(String[] args) { | |
ArrayList<String> strings = new ArrayList<String>(); | |
| |
strings.add("148th St & 1st Ave"); | |
strings.add("71st St & 10th Ave"); | |
strings.add("206th St & 9th Ave"); | |
strings.add("34th St & 3rd Ave"); | |
strings.add("220th St & 1st Ave"); | |
strings.add("131st St & 8th Ave"); | |
strings.add("109th St & 2nd Ave"); | |
strings.add("10th St & 1st Ave"); | |
strings.add("7th St & 11th Ave"); | |
strings.add("87th St & 9th Ave"); | |
strings.add("132nd St & 4th Ave"); | |
strings.add("145th St & 4th Ave"); | |
strings.add("96th St & 7th Ave"); | |
strings.add("87th St & 5th Ave"); | |
strings.add("86th St & 1st Ave"); | |
strings.add("54th St & 6th Ave"); | |
strings.add("111th St & 1st Ave"); | |
strings.add("69th St & 9th Ave"); | |
strings.add("7th St & 11th Ave"); | |
strings.add("57th St & 7th Ave"); | |
strings.add("94th St & 6th Ave"); | |
strings.add("122nd St & 10th Ave"); | |
strings.add("52nd St & 4th Ave"); | |
strings.add("210th St & 7th Ave"); | |
strings.add("44th St & 10th Ave"); | |
strings.add("44th St & 7th Ave"); | |
strings.add("119th St & 2nd Ave"); | |
strings.add("121st St & 3rd Ave"); | |
strings.add("40th St & 2nd Ave"); | |
strings.add("22nd St & 6th Ave"); | |
strings.add("111th St & 2nd Ave"); | |
strings.add("126th St & 11th Ave"); | |
strings.add("94th St & 1st Ave"); | |
strings.add("88th St & 4th Ave"); | |
strings.add("78th St & 9th Ave"); | |
strings.add("97th St & 1st Ave"); | |
strings.add("111th St & 10th Ave"); | |
strings.add("205th St & 8th Ave"); | |
strings.add("186th St & 11th Ave"); | |
strings.add("60th St & 3rd Ave"); | |
strings.add("106th St & 1st Ave"); | |
strings.add("162nd St & 1st Ave"); | |
strings.add("90th St & 8th Ave"); | |
strings.add("86th St & 1st Ave"); | |
strings.add("121st St & 5th Ave"); | |
strings.add("144th St & 11th Ave"); | |
strings.add("168th St & 4th Ave"); | |
strings.add("38th St & 1st Ave"); | |
strings.add("146th St & 4th Ave"); | |
strings.add("147th St & 3rd Ave"); | |
strings.add("205th St & 11th Ave"); | |
strings.add("15th St & 7th Ave"); | |
strings.add("88th St & 3rd Ave"); | |
strings.add("117th St & 6th Ave"); | |
strings.add("129th St & 1st Ave"); | |
strings.add("23rd St & 5th Ave"); | |
strings.add("136th St & 3rd Ave"); | |
strings.add("124th St & 2nd Ave"); | |
strings.add("164th St & 9th Ave"); | |
strings.add("10th St & 7th Ave"); | |
strings.add("8th St & 4th Ave"); | |
strings.add("181st St & 5th Ave"); | |
strings.add("197th St & 10th Ave"); | |
strings.add("213th St & 11th Ave"); | |
strings.add("80th St & 2nd Ave"); | |
strings.add("213th St & 4th Ave"); | |
strings.add("195th St & 8th Ave"); | |
strings.add("209th St & 6th Ave"); | |
strings.add("49th St & 11th Ave"); | |
strings.add("102nd St & 8th Ave"); | |
strings.add("151st St & 3rd Ave"); | |
strings.add("50th St & 10th Ave"); | |
strings.add("93rd St & 9th Ave"); | |
strings.add("204th St & 7th Ave"); | |
strings.add("177th St & 11th Ave"); | |
strings.add("223rd St & 7th Ave"); | |
strings.add("99th St & 10th Ave"); | |
strings.add("161st St & 4th Ave"); | |
strings.add("115th St & 6th Ave"); | |
strings.add("118th St & 2nd Ave"); | |
strings.add("208th St & 3rd Ave"); | |
| |
System.out.println("Hello World!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment