From 7ed86cb271ae4d28dffcac12e76d9e3cce7d3435 Mon Sep 17 00:00:00 2001 From: ji-hyup Date: Wed, 26 Aug 2026 15:13:54 +0900 Subject: [PATCH] 3940 --- ...3940. Limit Occurrences in Sorted Array.py" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "leetcode3/\353\263\200\354\247\200\355\230\221/v2/3940. Limit Occurrences in Sorted Array.py" diff --git "a/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3940. Limit Occurrences in Sorted Array.py" "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3940. Limit Occurrences in Sorted Array.py" new file mode 100644 index 00000000..cd32cea1 --- /dev/null +++ "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/3940. Limit Occurrences in Sorted Array.py" @@ -0,0 +1,18 @@ + +''' +1. 아이디어 : +2. 시간복잡도 : + o(n * m) + +3. 자료구조/알고리즘 : +''' +class Solution: + def limitOccurrences(self, nums: list[int], k: int) -> list[int]: + ans = [] + + for i in nums: + if len([j for j in ans if j == i]) == k: + continue + ans.append(i) + + return ans \ No newline at end of file