본문 바로가기
반응형

해커랭크7

[HackerRank] Print Prime Number 풀이 (Oracle) [HackerRank] Print Prime Number 풀이 (Oracle) 문제 Print Prime Numbers | HackerRank Print Prime Numbers | HackerRank Print prime numbers. www.hackerrank.com 1000 보다 작거나 같은 소수를 출력하는 쿼리를 작성합니다. 결과를 한 줄로 인쇄하고 '&' 문자를 구분 기호로 사용합니다. 예시) 10보다 작거나 같은 소수 출력 2&3&5&7 풀이 CONNECT BY LEVEL 구문으로 2이상 1000 이하의 ROW를 생성하고, WITH절을 사용하여 임시 테이블로 만들어 줍니다. NOT EXISTS 조건으로 약수 여부를 확인해서 제외합니다. 결과를 한 줄로 표시하기 위해 LISTAGG 함수를 활용했습니다. LISTAGG 함수 기본 사용법 (Oracle 11g 이상) LIST.. 2021. 3. 18.
[HackerRank] Binary Tree Nodes 풀이 (Oracle) [HackerRank] Binary Tree Nodes 풀이 (Oracle) 문제 Binary Tree Nodes | HackerRank Binary Tree Nodes | HackerRank Write a query to find the node type of BST ordered by the value of the node. www.hackerrank.com BST 테이블은 컬럼 N, P를 갖고 있습니다. 이진 트리 구조이며 N은 노드 값, P는 N의 부모 값입니다. 이진 트리의 노드 유형을 찾는 쿼리를 작성합니다. 노드 값 순으로 정렬해야 합니다. 각 노드의 유형은 아래와 같이 출력합니다. Root: 최상위 노드인 경우 Leaf: 최하위 노드인 경우 Inner: 루트 노드도 리프 노드도 아닌 경우 풀이 계층구조 쿼리의 START WITH 절에서는 루트(부모행)로 사용될 행을.. 2021. 3. 16.
[HackerRank] Weather Observation Station 20 풀이 (Oracle) [HackerRank] Weather Observation Station 20 풀이 (Oracle) 문제 Weather Observation Station 20 | HackerRank Weather Observation Station 20 | HackerRank Query the median of Northern Latitudes in STATION and round to 4 decimal places. www.hackerrank.com Station에서 북위도(LAT_N)의 중앙값을 소숫점 4자리수까지 반올림하여 출력합니다. 풀이 중앙값은 주어진 수를 크기순으로 정렬했을 때 가장 가운데에 있는 값입니다. 표본의 개수가 짝수여서 중앙값이 두 개가 될 경우는 두 수의 평균을 구합니다. 표본의 개수(n)가 홀수 일 때 → (n + 1) / 2 번째 값 표본의 개수(n)가 짝수 일 때 → n / 2, n /.. 2021. 3. 15.
[HackerRank] Interviews 풀이 (Oracle) [HackerRank] Interviews 풀이 (Oracle) 문제 Interviews | HackerRank Interviews | HackerRank find total number of view, total number of unique views, total number of submissions and total number of accepted submissions. www.hackerrank.com 문제 해설 Samantha는 코딩 챌린지와 컨테스트를 통해 여러 대학의 많은 후보자를 인터뷰합니다. contest_id, hacker_id, name과 각 컨테스트 별 total_submissions, total_accepted_submissions, total_views, total_unique_views의 합계를 출력합니다. 4개의 합계가 모두 0이면 해.. 2021. 3. 10.
반응형