artifacts.log

Home

❯

programming

❯

Algorithms

❯

프로그래머스_나머지가 1이 되는 수 찾기

프로그래머스_나머지가 1이 되는 수 찾기

2026년 11월 07일1 min read

  • 알고리즘
  • 코딩-테스트
  • 프로그래머스
import java.util.ArrayList;
 
class Solution {
    public int solution(int n) {
        int answer = 0;
        for(int x = 2; x<n; x++){
            if(n % x == 1){
                answer = x;
                break;
            }
        }
        return answer;
    }
}

https://school.programmers.co.kr/learn/challenges


Created with Quartz v4.5.2 © 2026

  • GitHub