https://school.programmers.co.kr/learn/courses/30/lessons/131701
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
나의풀이
import java.util.*;
class Solution {
public int solution(int[] elements) {
Set<Long> set = new HashSet<>();
int s=elements.length;
for(int i=0; i<elements.length; i++){
long temp=0;
for(int j=i; j<i+s; j++){
temp+=elements[j%s];
set.add(temp);
}
}
return set.size() ;
}
}'코테풀이' 카테고리의 다른 글
| [프로그래머스] 숫자 변환하기 java (LEVEL2) (0) | 2023.05.11 |
|---|---|
| [프로그래머스] 뒤에 있는 큰 수 찾기 java (LEVEL2) (0) | 2023.05.11 |
| [프로그래머스] 네트워크 java (LEVEL3) (0) | 2023.04.30 |
| [프로그래머스] 게임 맵 최단거리 java (LEVEL2) (0) | 2023.04.30 |
| [프로그래머스] 피로도 java (LEVEL2) (0) | 2023.04.30 |