본문 바로가기

hackerrank6

Hackerrank The Grid Search 풀이 The Grid Search 문제 : https://www.hackerrank.com/challenges/the-grid-search/problem 풀이 및 시간복잡도 주석에 풀이 및 시간 복잡도 써놓음. public class TheGridSearch { private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int i = 0 ; i < t ; i++) { /** grid row */ int R = in.nextInt(); /** grid column */ in.. 2020. 10. 7.
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 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.
Hackerrank Bigger is greater Hackerrank Bigger is greater 문제 : https://www.hackerrank.com/challenges/bigger-is-greater/problem source 순열의 다음 수를 구하는 문제와 동일. 최악의 경우 시간복잡도 O(n 제곱) 문제 푸는 방법은 아래 주석에 있고, 간략히 요약하면 turning point 를 찾은 뒤, turning point 보다 크지만 가장 작은 수를 찾는게 핵심 아래 테스트케이스 소스도 같이 있음. public class BiggerIsGreater { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int count = scan.nextInt(); S.. 2020. 9. 14.