본문 바로가기

코딩일기

(127)
알고리즘 코드카타 113 - 전력망을 둘로 나누기 https://school.programmers.co.kr/learn/courses/30/lessons/86971 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 문제 설명 n개의 송전탑이 전선을 통해 하나의 트리 형태로 연결되어 있습니다. 당신은 이 전선들 중 하나를 끊어서 현재의 전력망 네트워크를 2개로 분할하려고 합니다. 이때, 두 전력망이 갖게 되는 송전탑의 개수를 최대한 비슷하게 맞추고자 합니다. 송전탑의 개수 n, 그리고 전선 정보 wires가 매개변수로 주어집니다. 전선들 중 하나를 끊어서 송전탑 개수가 가능한 비슷하도록 두 전력망으로 나누었을 때..
SQL 코드카타 160 - Weather Observation Station 15 https://www.hackerrank.com/challenges/weather-observation-station-15/problem?isFullScreen=true Weather Observation Station 15 | HackerRankQuery the Western Longitude for the largest Northern Latitude under 137.2345, rounded to 4 decimal places.www.hackerrank.com FieldTypeIDNUMBERCITYVARCHAR2(21)STATEVARCHAR2(2)LAT_NNUMBERLONG_WNUMBER STATION 테이블:ID: 테이블의 고유 키CITY : 도시의 이름STATE : 주의 이름LAT_N : 위도L..
SQL 코드카타 159 - Weather Observation Station 14 https://www.hackerrank.com/challenges/weather-observation-station-14/problem?isFullScreen=true Weather Observation Station 14 | HackerRankQuery the greatest value of the Northern Latitudes from STATION that are under 137.2345 and truncated to 4 decimal places.www.hackerrank.com FieldTypeIDNUMBERCITYVARCHAR2(21)STATEVARCHAR2(2)LAT_NNUMBERLONG_WNUMBER STATION 테이블:ID: 테이블의 고유 키CITY : 도시의 이름STATE : ..
SQL 코드카타 158 - Weather Observation Station 13 https://www.hackerrank.com/challenges/weather-observation-station-13/problem?isFullScreen=true Weather Observation Station 13 | HackerRankQuery the sum of Northern Latitudes having values greater than 38.7880 and less than 137.2345, truncated to 4 decimal places.www.hackerrank.com FieldTypeIDNUMBERCITYVARCHAR2(21)STATEVARCHAR2(2)LAT_NNUMBERLONG_WNUMBER STATION 테이블:ID: 테이블의 고유 키CITY : 도시의 이름STATE..
SQL 코드카타 157 - Top Earners https://www.hackerrank.com/challenges/earnings-of-employees/problem?isFullScreen=true Top Earners | HackerRankFind the maximum amount of money earned by any employee, as well as the number of top earners (people who have earned this amount).www.hackerrank.com ColumnTypeemployee_idIntegernamestringmonthsInteger salaryInteger Employee 테이블:employee_id : 테이블의 고유 키name : 직원의 이름months : 근속기간salary : 급..
SQL 코드카타 156 - The Blunder https://www.hackerrank.com/challenges/the-blunder/problem?isFullScreen=true The Blunder | HackerRankQuery the amount of error in Sam's result, rounded up to the next integer.www.hackerrank.com ColumnTypeIDIntegerNAMEInteger SALARYInteger EMPLOYEES 테이블:ID : 테이블의 고유 키NAME : 직원의 이름SALARY : 급여모든 직원에 대한 월평균 급여를 계산하는 작업을 맡았으나, 계산을 완료한 후 키보드의 '0' 키가 고장 난 것을 알게 되었습니다. 그녀는 '0'이 제거된 급여를 사용하여 잘못 계산한 값과 실제 ..
DFS와 DFS https://www.acmicpc.net/problem/1260문제그래프를 DFS로 탐색한 결과와 BFS로 탐색한 결과를 출력하는 프로그램을 작성하시오. 단, 방문할 수 있는 정점이 여러 개인 경우에는 정점 번호가 작은 것을 먼저 방문하고, 더 이상 방문할 수 있는 점이 없는 경우 종료한다. 정점 번호는 1번부터 N번까지이다.입력첫째 줄에 정점의 개수 N(1 ≤ N ≤ 1,000), 간선의 개수 M(1 ≤ M ≤ 10,000), 탐색을 시작할 정점의 번호 V가 주어진다. 다음 M개의 줄에는 간선이 연결하는 두 정점의 번호가 주어진다. 어떤 두 정점 사이에 여러 개의 간선이 있을 수 있다. 입력으로 주어지는 간선은 양방향이다.출력첫째 줄에 DFS를 수행한 결과를, 그 다음 줄에는 BFS를 수행한 결과를 ..
SQL 코드카타 155 - Population Density Difference https://www.hackerrank.com/challenges/population-density-difference/problem?isFullScreen=true Population Density Difference | HackerRankQuery the difference between the maximum and minimum city populations in CITY.www.hackerrank.com FieldTypeIDNUMBERNAMEVARCHAR2(17)COUNTRYCODEVARCHAR(3)DISTRICTVARCHAR2(20)POPULATIONNUMBER CITY 테이블:ID : 테이블의 고유 키NAME : 도시의 이름COUNTRYCODE : 국가코드DISTRICT : 지역POPULAT..