slight optimization in manahattanDistance
slight optimization in manahattanDistance