From 5b436c6b25ba5410d1140c722c3cba63f275f2de Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Mon, 27 Jul 2026 15:33:53 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[=EC=9D=B4=EC=A7=84=ED=9D=AC]=20Day28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../3663. Find The Least Frequent Digit.java" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/3663. Find The Least Frequent Digit.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/3663. Find The Least Frequent Digit.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/3663. Find The Least Frequent Digit.java" new file mode 100644 index 00000000..686f9b7f --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/3663. Find The Least Frequent Digit.java" @@ -0,0 +1,35 @@ +/* + +1. 아이디어 : 숫자의 빈도수 계산 후, 가장 빈도수가 적은 숫자 반환 + 정답이 여러개일 경우 더 작은 숫자 반환 + 각 숫자를 카운팅하여 계산 후 해결 + +2. 시간복잡도 : O(31 + 10) => O(1) + +3. 자료구조/알고리즘 : 배열 + + */ + +class Solution { + public int getLeastFrequentDigit(int n) { + int[] nums = new int[10]; + + while(n > 0) { + int num = n%10; + nums[num]++; + + n/=10; + } + + int minNum = 0; + int minCnt = 100; + for(int i=0; i<10; i++) { + if(nums[i] == 0 || minCnt<=nums[i]) continue; + + minNum = i; + minCnt = nums[i]; + } + + return minNum; + } +} \ No newline at end of file From d23e1530c8ff4eb25a3adacf1878d000f83b56ca Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Mon, 27 Jul 2026 16:41:02 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[=EC=9D=B4=EC=A7=84=ED=9D=AC]=20Day26?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../809. Expressive Words.java" | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/809. Expressive Words.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/809. Expressive Words.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/809. Expressive Words.java" new file mode 100644 index 00000000..a0696746 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/809. Expressive Words.java" @@ -0,0 +1,69 @@ +/* + +1. 아이디어 : 조건에 맞춰 구현 + 리스트를 사용하여 각 문자열을 압축, 각각의 개수 구함 + words 배열을 완전탐색하여 똑같이 계산 후, 늘릴수 있는지, 조건에 맞춰 하나하나 비교 + +2. 시간복잡도 : O(S+N*M) (N = words.length, M = words 배열의 각 단어의 길이) + +3. 자료구조/알고리즘 : 구현 + + */ + +class Solution { + private List ori; + + public int expressiveWords(String s, String[] words) { + ori = new ArrayList<>(); + char memo = s.charAt(0); + int cnt = 1; + int ans = 0; + + for(int i=1; i tmp = new ArrayList<>(); + char memo = s.charAt(0); + int cnt = 1; + int ans = 0; + + for(int i=1; i