diff --git "a/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3498.java" "b/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3498.java" new file mode 100644 index 00000000..537165a8 --- /dev/null +++ "b/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3498.java" @@ -0,0 +1,24 @@ +package Leetcode.최원준; + +/* +1. 아이디어 : +- + +2. 시간복잡도 : +O( n ) + +3. 자료구조/알고리즘 : +- / - + */ + +public class Q3498 { + class Solution { + public int reverseDegree(String s) { + int n = s.length(), ans = 0; + for (int i=0; i pq = new PriorityQueue<>((a, b) -> Double.compare(b,a)); + for (int num : nums) { + total += num; + pq.add(num + 0.0); + } + + double target = total / 2; + while (total > target) { + ans++; + double halfed = pq.poll()/2; + total -= halfed; + pq.add(halfed); + } + return ans; + } + } +} diff --git "a/leetcode2/3hard/\354\265\234\354\233\220\354\244\200/Q1220.java" "b/leetcode2/3hard/\354\265\234\354\233\220\354\244\200/Q1220.java" new file mode 100644 index 00000000..b76e4a34 --- /dev/null +++ "b/leetcode2/3hard/\354\265\234\354\233\220\354\244\200/Q1220.java" @@ -0,0 +1,40 @@ +package Leetcode.최원준; + +/* +1. 아이디어 : +dp 문제 + +2. 시간복잡도 : +O( 5 * n ) + +3. 자료구조/알고리즘 : +2차원 배열 / dp + */ + +public class Q1220 { + class Solution { + int MOD = 1_000_000_007; + public int countVowelPermutation(int n) { + /* + 1. e a + 2. a,i e + 3. i not i + 4. i,u o + 5. u a + */ + long[][] dp = new long[n+1][5]; + dp[1] = new long[]{1, 1, 1, 1, 1}; // a e i o u + + for (int i=2; i