728x90
알고리즘 스터디
어제부터 시작한 스터디
https://www.notion.so/1f167f8e832781d28994c84a11470c39
https://www.acmicpc.net/problem/3184
https://school.programmers.co.kr/learn/courses/30/lessons/42747?language=java
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
오늘은 백준의 양, 프로그래머스의 H-Index를 풀었다.
H-Index는 나만 이분탐색으로 풀었는데 다른 분들이 대단하다고 했지만 나는 다른분들 코드가 더 어려웠다..!
import java.util.*;
// 혜주님
class Solution {
public int solution(int[] citations) {
Arrays.sort(citations);
int cnt = 0;
int max = Integer.MIN_VALUE;
for(int i=citations.length-1 ; i>=0 ; i--){
cnt++;
max = Math.max(max, Math.min(cnt, citations[i]));
}
//6 5 3 1 0
return max;
}
}
// 진영님
import java.util.*;
class Solution {
public int solution(int[] citations) {
int answer = 0;
Arrays.sort(citations);
int count = 0;
for (int i = citations.length - 1; i >= 0; i--) {
int value = citations[i];
count++;
if (count <= value) continue;
else return count - 1;
}
return citations.length;
}
}
// 나
class Solution {
public int solution(int[] citations) {
int answer = 0;
int l = 0, r = 10_000;
while(l<=r){
int m = (l+r)/2;
if(check(citations, m)){
l = m+1;
answer = m;
}else{
r = m-1;
}
}
return answer;
}
boolean check(int[] citations, int h){
int countEqualsOrBig = 0;
for(int i : citations){
if(i >= h){
countEqualsOrBig++;
}
}
return h <= countEqualsOrBig;
}
}
발표 스터디
오늘 첫 발표스터디!
나는 적용했던 디자인 패턴을 주제로 진행했다.
interview-study/박지은/20250513_디자인패턴 컴포넌트패턴과 전략패턴.md at main · HI-dle/interview-study
Contribute to HI-dle/interview-study development by creating an account on GitHub.
github.com
위는 손글씨로 요약해본 내용!
728x90
'TIL' 카테고리의 다른 글
[TIL] 2025.05.15 (목) | 입력값 반복문 순서를 주의하자.. (0) | 2025.05.15 |
---|---|
[TIL] 2025.05.14(수) (0) | 2025.05.14 |
[TIL] 2025.05.12 (0) | 2025.05.12 |
[TIL] 2025.03.10 서브모듈, 서브트리 (0) | 2025.03.10 |
[TIL] 2025.03.06 java 직렬화 serialVersionUID (0) | 2025.03.06 |