🤔 문제 분석
Consider p1(a,b) and p2(c,d) to be two points on a 2D plane.
- a happens to equal the minimum value in Northern Latitude (LAT_N in STATION).
- b happens to equal the minimum value in Western Longitude (LONG_W in STATION).
- c happens to equal the maximum value in Northern Latitude (LAT_N in STATION).
- d happens to equal the maximum value in Western Longitude (LONG_W in STATION).
Query the Manhattan Distance between points p1 and p2 and round it to a scale of decimal places.
맨하튼 거리: |c-a| + |d-b|
💡 풀이
SELECT ROUND(ABS(MAX(LAT_N) - MIN(LAT_N)) + ABS(MAX(LONG_W) - MIN(LONG_W)), 4)
FROM STATION
'코딩테스트 > 해커랭크 SQL' 카테고리의 다른 글
[해커랭크/SQL] 38. Contest Leaderboard (0) | 2023.03.17 |
---|---|
[해커랭크/SQL] 37. The Report (0) | 2023.03.16 |
[해커랭크/SQL] 35. Binary Tree Nodes (0) | 2023.03.14 |
[해커랭크/SQL] 34. Occupations(피봇테이블, 윈도우함수) (0) | 2023.03.14 |
[해커랭크/SQL] 33. Weather Observation Station 14 (0) | 2023.03.13 |
댓글