From cece58ece0075874091e68d1967ad159d0134bf3 Mon Sep 17 00:00:00 2001 From: masterMJ Date: Fri, 14 Aug 2026 20:31:33 +0900 Subject: [PATCH] Create 3471. Find the Largest Almost Missing Integer.py --- ...ind the Largest Almost Missing Integer.py" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "leetcode3/\352\271\200\353\257\274\354\240\234/3471. Find the Largest Almost Missing Integer.py" diff --git "a/leetcode3/\352\271\200\353\257\274\354\240\234/3471. Find the Largest Almost Missing Integer.py" "b/leetcode3/\352\271\200\353\257\274\354\240\234/3471. Find the Largest Almost Missing Integer.py" new file mode 100644 index 00000000..4ea99ec0 --- /dev/null +++ "b/leetcode3/\352\271\200\353\257\274\354\240\234/3471. Find the Largest Almost Missing Integer.py" @@ -0,0 +1,19 @@ + +class Solution: + def largestInteger(self, nums: List[int], k: int) -> int: + count = {} + + for i in range(len(nums) - k + 1): + sub = set(nums[i:i+k]) + + for num in sub: + count[num] = count.get(num, 0) + 1 + + answer = -1 + + for num in count: + if count[num] == 1: + answer = max(answer, num) + + return answer +