내일배움캠프 42일차 TIL _ 9주 4일차
2024. 6. 13. 11:39ㆍTIL Java
- 오늘 있었던 일
- 팀과제
- 알고리즘
SPRIONG
- 스프링 정리
더보기

AOP (Aspect Oriented Programming)
- AOP 를 통해 부가기능을 모듈화
- **'부가기능'**은 '핵심기능'과는 관점(Aspect), 관심이 다릅니다.
- 따라서 '핵심기능'과 분리해서 '부가기능' 중심으로 설계, 구현 가능합니다.

- 포인트컷
- execution(modifiers-pattern? return-type-pattern declaring-type-pattern? method-name-pattern(param-pattern) throws-pattern?)
- modifiers-pattern
- public, private, *
- return-type-pattern
- void, String, List<String>, *****
- declaring-type-pattern
- 클래스명 (패키지명 필요)
- com.sparta.myselectshop.controller.* - controller 패키지의 모든 클래스에 적용
- com.sparta.myselectshop.controller.. - controller 패키지 및 하위 패키지의 모든 클래스에 적용
- method-name-pattern(param-pattern)
- 함수명
- addFolders : addFolders() 함수에만 적용
- add* : add 로 시작하는 모든 함수에 적용
- 파라미터 패턴 (param-pattern)
- (com.sparta.myselectshop.dto.FolderRequestDto) - FolderRequestDto 인수 (arguments) 만 적용
- () - 인수 없음
- (*) - 인수 1개 (타입 상관없음)
- (..) - 인수 0~N개 (타입 상관없음)
- 함수명
- @Pointcut
- 포인트컷 재사용 가능
- 포인트컷 결합 (combine) 가능
-
@Pointcut("execution(* com.sparta.newsfeed.controller..*(..))") public void Controller() {} @Before("Controller()") public void logBeforeMethodExecution(JoinPoint joinPoint) {}
- 이런 식으로 사용가능함
- modifiers-pattern
- execution(modifiers-pattern? return-type-pattern declaring-type-pattern? method-name-pattern(param-pattern) throws-pattern?)
알고리즘 문제 풀기
● H-Index
더보기
● H-Index //링크
import java.util.*;
class Solution {
public int solution(int[] citations) {
Integer[] in = Arrays.stream(citations).boxed().toArray(Integer[]::new);
Arrays.sort(in, Collections.reverseOrder());
if(in[0] == 0) return 0;
int answer = 0;
for(int i=0; i<citations.length; i++){
if(in[i] >= i){
if(in[i] >= i+1)
answer = i+1;
}
}
return answer;
}
}
- 두번만에 통과했다.
- 문제 지문에
- 논문 n편 중, h번 이상 인용된 논문이 h편 이상이고 나머지 논문이 h번 이하 인용되었다면 h의 최댓값이 이 과학자의 H-Index입니다.
- ???? 뭐라고 하는거지?
- 문제를 전혀 이해하지 못해서 질문판에 들어가 문제 해설을 보고난 다음 풀었다. 뭐지 이 문제
- 문제 지문에
- 밑은 다른 사람의 풀이
-
import java.util.*; class Solution { public int solution(int[] citations) { Arrays.sort(citations); int max = 0; for(int i = citations.length-1; i > -1; i--){ int min = (int)Math.min(citations[i], citations.length - i); if(max < min) max = min; } return max; } }
- ?원소 값은 점점 감소하고, 원소 값 이상인 것의 개수는 점점 감소하므로... 이 두 값의 최소값의 변화가 증가하다가 감소하는 지점을 찾았다?!
당일 회고
- 생각보다 과제가 오래걸린다 오류도 많이 나고... 어째서
'TIL Java' 카테고리의 다른 글
내일배움캠프 44일차 TIL _ 10주 1일차 (0) | 2024.06.17 |
---|---|
내일배움캠프 43일차 TIL _ 9주 5일차 (0) | 2024.06.14 |
내일배움캠프 41일차 TIL _ 9주 3일차 (0) | 2024.06.12 |
내일배움캠프 40일차 TIL _ 9주 2일차 (0) | 2024.06.11 |
내일배움캠프 39일차 TIL _ 9주 1일차 (0) | 2024.06.10 |