`public static class
if (str1.charAt(i - 1) == str2.charAt(j - 1)) {
dp[i][j] = dp[i - 1][j - 1] + 1;
}
else {
dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
}
Arrays.sort(files, new Comparator<String> () {
@Override
public int compare(String o1, String o2) {
String head1 = o1.split("[0-9]")[0];
String head2 = o2.split("[0-9]")[0];
int result = head1.toLowerCase().compareTo(head2.toLowerCase());
//head가 같을경우
if(result == 0) {
result = compareNumber(o1, head1) - compareNumber(o2, head2);
}
return result;
}
Collections.sort(people, new Comparator<Person>() {
@Override
public int compare(Person p1, Person p2) {
return Integer.compare(p1.age, p2.age);
}
});
Map<String, Integer> map = new HashMap<>();
for (int i = 0; i < participant.length; i++) {
if (map.containsKey(participant[i])) {
map.put(participant[i], map.get(participant[i]) + 1);
} else {
map.put(participant[i], 1);
}
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
String key = entry.getKey();
Integer value = entry.getValue();
}
PriorityQueue<Integer> minHeap = new PriorityQueue<>();
PriorityQueue<Integer> minHeap = new PriorityQueue<?>(Collections.reverseOrder()); // 내림차순
minHeap.add(i); // 넣기
minHeap.peek(); // 값 확인
minHeap.poll(); // 빼기