Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 패캠챌린지
- group by
- 해커랭크
- RANK
- medium
- 프로그래머스
- 직장인인강
- 패스트캠퍼스후기
- solvesql
- LeetCode
- Hackerrank
- HACKER_RANK
- 프리미엄
- SQL
- Hard
- 패스트캠퍼스
- 시계열데이터분석
- lv.4
- recursive
- 다시풀어보기
- SELF-JOIN
- meidum
- join
- 파이썬을활용한시계열데이터분석
- easy
- 파이썬을활용한시계열데이터분석AtoZ올인원패키지Online
- 어려웠음
- 직장인자기계발
- MySQL
- row_number
Archives
- Today
- Total
~고군분투 인생살이~
[MEDIUM] Weather Observation Station 18 본문
Weather Observation Station 18 | HackerRank
Query the Manhattan Distance between two points, round or truncate to 4 decimal digits.
www.hackerrank.com
문제 조건
Consider P1(a,b) and P2(c,d) to be two points on a 2D plane.
- happens to equal the minimum value in Northern Latitude (LAT_N in STATION).
- happens to equal the minimum value in Western Longitude (LONG_W in STATION).
- happens to equal the maximum value in Northern Latitude (LAT_N in STATION).
- 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:

문제 풀이
두 점을 명시를 해줬기 때문에 max(lat_n)-min(lat_n) + max(long_w)-min(long_w)로 간단하게 풀 수 있었음
select round((max(lat_n)-min(lat_n)) + (max(long_w)-min(long_w)),4)
from station
'SQL > HACKER_RANK' 카테고리의 다른 글
[Easy] Weather Observation Station 3 (0) | 2022.10.24 |
---|---|
[EASY] Weather Observation Station 1 (0) | 2022.10.24 |
[MEDIUN] New Companies (0) | 2022.10.13 |
[EASY] Japanese Cities' Names (0) | 2022.10.13 |
[EASY] Japanese Cities' Attributes (0) | 2022.10.13 |
Comments