Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions 5주차/12914/12914_고혁진.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution {
public long solution(int n) {
long[] arr = new long[n+1];
arr[0] = 1;
arr[1] = 1;

for(int i=2; i<n+1; i++) {
arr[i] = arr[i-1] + arr[i-2];
arr[i] %= 1234567;
}

long answer = arr[n];
return answer;
}
}
28 changes: 28 additions & 0 deletions 5주차/131127/131127_고혁진.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import java.util.*;

class Solution {
public int solution(String[] want, int[] number, String[] discount) {
int answer = 0;
Map<String, Integer> hm = new HashMap<String, Integer>();

for(int i=0; i<want.length; i++)
hm.put(want[i], number[i]);

for(int j=0; j<discount.length - 9; j++){
int idx = 0;
Map<String, Integer> map = new HashMap<String, Integer>();

for(int i=0; i<10; i++)
map.put(discount[i+j], map.getOrDefault(discount[i+j], 0) + 1);

for (Map.Entry<String, Integer> entry : hm.entrySet())
if(map.containsKey(entry.getKey()) && entry.getValue()<=map.get(entry.getKey()))
idx++;

if(idx == want.length)
answer++;
}

return answer;
}
}