2차원 좌표 평면에 변이 축과 평행한 직사각형이 있습니다. 직사각형 네 꼭짓점의 좌표 [[x1, y1], [x2, y2], [x3, y3], [x4, y4]]가 담겨있는 배열 dots가 매개변수로 주어질 때, 직사각형의 넓이를 return 하도록 solution 함수를 완성해보세요.
| dots | result | 
|---|---|
| [[1, 1], [2, 1], [2, 2], [1, 2]] | 1 | 
| [[-1, -1], [1, 1], [1, -1], [-1, 1]] | 4 | 
class Solution {
    public int solution(int[][] dots) {
        int x1 = 0; int y1 = 0;
        
        for(int i = 1; i < 4; i++) {
            if((dots[0][0] != dots[i][0]) && (dots[0][1] != dots[i][1])) {
                x1 = dots[i][0];
                y1 = dots[i][1];
                break;
            }
        }
        
        int xdistance = (int)Math.sqrt((int)(Math.pow(dots[0][0] - x1, 2)));
        int ydistance = (int)Math.sqrt((int)(Math.pow(dots[0][1] - y1, 2)));
        int area = xdistance * ydistance;
        
        return area;
    }
}
두 점 사이의 거리 공식 이용
