JAVA_LeetCode 2549_Count Distinct Numbers on Board 풀이 class Solution { public int distinctIntegers(int n) { // 자기 자신과 나눴을 때 1이 남는 경우 set에 담아준다. Set set = new HashSet(); set.add(n); while(n > 0){ for(int i = 1; i <= n; i++){ if(n % i == 1) set.add(i); } n--; } return set.size(); } } * 출처 https://leetcode.com/problems/count-distinct-numbers-on-board...
JAVA_LeetCode 2549_Count Distinct Numbers on Board에 대한 요약내용입니다.
자세한 내용은 아래에 원문링크를 확인해주시기 바랍니다.