본문 바로가기

algorithm63

hackerrank case when 문제 풀이 문제 https://www.hackerrank.com/challenges/what-type-of-triangle/problem?h_r=internal-search 요약하면 A,B,C 세 길이가 주어지고, A,B,C 를 각각 판단해서 이름을 alias 붙여주면 됨. 풀이 select case when (A + B 2020. 9. 27.
hackerrank Top Earners 풀이 Top Earners 문제 : https://www.hackerrank.com/challenges/earnings-of-employees/problem?h_r=internal-search 요약하면 EMPLOYEE 테이블에서 제일 높은 연봉을 구하고. 해당 연봉을 받는 사람을 구하라. 연봉은 months * salary 풀이 oracle select maxEarning, num from ( select months * salary as maxEarning ,count(*) as num from Employee group by months * salary order by months * salary desc ) where rownum = 1 ; mysql select months * salary as max.. 2020. 9. 23.
hackerrank Non-Divisible Subset 풀이 Non-Divisible Subset 문제 https://www.hackerrank.com/challenges/non-divisible-subset/problem 문제가 헷갈렸음. 문제 요약하면 array 가 주어지는데, 그 array 중 부분집합을 선택하는데. 이 부분집합의 2개 원소의 합은 k에 의해 나뉘어지면 안된다. source public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] arr = new int[k]; for (int i = 0; i < n; i++) { arr[sc.nextInt() % k]++; } System.. 2020. 9. 21.
hackerrank the-time-in-words 풀이 hackerrank the-time-in-words 문제 https://www.hackerrank.com/challenges/the-time-in-words/problem 풀이 m 에 대해 비교. m = 0 , 1 2020. 9. 18.