From c098e1b7f92bc22281396e69dd234fa17889919e Mon Sep 17 00:00:00 2001 From: SinnoLn Date: Fri, 14 Aug 2026 13:00:51 +0900 Subject: [PATCH] 3471. Find the Largest Almost Missing Integer --- ...d the Largest Almost Missing Integer.java" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "leetcode3/\354\235\264\354\247\204\355\235\254/3471. Find the Largest Almost Missing Integer.java" diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/3471. Find the Largest Almost Missing Integer.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/3471. Find the Largest Almost Missing Integer.java" new file mode 100644 index 00000000..8b1a4388 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/3471. Find the Largest Almost Missing Integer.java" @@ -0,0 +1,30 @@ +/* + +1. 아이디어 : 모든 k구간을 완전탐색으로 돌며 등장하는 구간 안 중복되지 않은 숫자를 각각 카운트, 가장 큰 수 반환 + 슬라이딩 윈도우 기법으로 풀려고 했지만, 중복된 숫자가 등장하는 경우를 처리하기가 까다로워 완전탐색으로 품 + +2. 시간복잡도 : O(N*K+50) + +3. 자료구조/알고리즘 : 완전탐색, Set + + */ + +class Solution { + public int largestInteger(int[] nums, int k) { + int[] cnt = new int[51]; + for(int i=0; i<=nums.length-k; i++) { + Set set = new HashSet<>(); + for(int j=i; j=0; i--) { + if(cnt[i] == 1) return i; + } + + return -1; + } +} \ No newline at end of file