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 |
31 |
Tags
- StringTokenizer
- 스프링부트 도커 배포
- 스프링부트 도커
- 이진수 변환
- 백준
- 자바
- lv0
- Queue
- Programmers
- 백준 N과 M 자바
- 오름차순 정렬
- 알고리즘
- 프로그래머스 문자열 정렬
- 삼각형의 완성조건
- COS Pro
- Stack
- 큐
- SWEA
- lv2
- 스택
- 프로그래머스 자바
- 문자열
- 스프링부트 도커로 배포
- index of
- 클라이언트
- Lv1
- 프로그래머스
- java
- 버퍼
- 프로그래머스 풀이
Archives
- Today
- Total
mun dev
[HackerRank] Weather Observation Station 5 오라클 풀이 본문
문제링크
Weather Observation Station 5 | HackerRank
Write a query to print the shortest and longest length city name along with the length of the city names.
www.hackerrank.com
풀이
도시이름중 문자열 길이가 가장 긴 값과 짧은 값을 구하기 때문에
각 도시의 이름 별로 정렬하고(오름차순, 내림차순)
가장 위에 있는 하나의 행만 출력하면 문제 조건에 맞게 풀이할 수 있다.
코드
select *
from(
select city, length(city)
from station
order by length(city) asc, city asc
)
where rownum < 2;
select *
from(
select city, length(city)
from station
order by length(city) desc, city desc
)
where rownum < 2;
'알고리즘 > HackerRank' 카테고리의 다른 글
[HackerRank] Weather Observation Station 8 오라클 풀이 (0) | 2024.01.29 |
---|---|
[HackerRank] Weather Observation Station 7 오라클 풀이 (0) | 2024.01.29 |
[HackerRank] Occupations 오라클 풀이 (0) | 2024.01.29 |
[HackerRank] Weather Observation Station 18 오라클 풀이 (0) | 2024.01.26 |
[HackerRank] New Companies 오라클 풀이 (0) | 2024.01.26 |