uploaded at 2022. 12. 8. 오후 5:52:45
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/87389
|
||||||
|
|
||||||
|
class Solution {
|
||||||
|
public int solution(int n) {
|
||||||
|
int answer = 0;
|
||||||
|
for (int i = 1; i < n; i++){
|
||||||
|
if(n%i==1){
|
||||||
|
answer = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user