Description

The rectangle is a figure with four straight sides and four right angles. Given 3 points of a rectangle in a coordinate plane, figure out the last point to make a rectangle.

v is an array, containing 3 points of a rectangle. By using v, make a solution function that returns the last point.

Constraints
  • v is an array, containing 3 points of a triangle.
  • Each of v's element has x and y coordinates, which represents a point of a rectangle.
  • In v, two points can be connected either with a vertical or horizontal line.
  • Each coordinate is a natural number, less than or equal to 1 billion.
  • Return the last point, [coordiante x, coordinate y].
Examples
v result
[[1, 4], [3, 4], [3, 10]] [1, 10]
[[1, 1], [2, 2], [1, 2]] [2, 1]

Example #1
When there are 3 points: [1, 4], [3, 4], [3, 10]
[1,10] will make a rectangle.

Example #2
When there are 3 points: [[1, 1], [2, 2], [1, 2]]
[2,1] will make a rectangle.

Result Stop
내가 제출한 코드가 왜 틀렸는지 프로그래머스 AI에게 물어보세요.
제출 후 채점하기를 눌러 30점 이상인 경우 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.