728x90
반응형
https://www.hackerrank.com/challenges/weather-observation-station-18/problem?isFullScreen=true
문제
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 and and round it to a scale of decimal places.
Input Format
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.
Code
SELECT ROUND(ABS(MAX(LAT_N) - MIN(LAT_N)), 4) + ROUND(ABS(MAX(LONG_W) - MIN(LONG_W)), 4)
FROM STATION
728x90
반응형
'SQL > MySQL' 카테고리의 다른 글
[MySQL/HackerRank] Draw The Triangle 1 (0) | 2023.08.29 |
---|---|
[MySQL/HackerRank] Weather Observation Station 19 (0) | 2023.08.25 |
[MySQL/HackerRank] Weather Observation Station 17 (0) | 2023.08.25 |
[MySQL/HackerRank] Weather Observation Station 16 (0) | 2023.08.25 |
[MySQL/HackerRank] Weather Observation Station 15 (0) | 2023.08.25 |