## Sunday, March 4, 2018

### codefights darkwilderness

My answer is O(n) and just use Math.abs

Given the positions of a white `bishop` and a black `pawn` on the standard chess board, determine whether the bishop can capture the pawn in one move.
The bishop has no restrictions in distance for each move, but is limited to diagonal movement. Check out the example below to see how it can move:
Example
• For `bishop = "a1"` and `pawn = "c3"`, the output should be
`bishopAndPawn(bishop, pawn) = true`.
• For `bishop = "h1"` and `pawn = "h3"`, the output should be
`bishopAndPawn(bishop, pawn) = false`.
Input/Output
• [execution time limit] 3 seconds (java)
• [input] string bishop
Coordinates of the white bishop in the chess notation.
• [input] string pawn
Coordinates of the black pawn in the same notation.
• [output] boolean
`true` if the bishop can capture the pawn, `false` otherwise.
[Java] Syntax Tips
``````// Prints help message to the console
// Returns a string
//
// Globals declared here will cause a compilation error,
// declare variables inside the function instead!
String helloWorld(String name) {
System.out.println("This prints to the console when you Run Tests");
return "Hello, " + name;
}``````