Skip to content

Commit 7ed86cb

Browse files
committed
3940
1 parent b8563a2 commit 7ed86cb

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
'''
3+
1. 아이디어 :
4+
2. 시간복잡도 :
5+
o(n * m)
6+
7+
3. 자료구조/알고리즘 :
8+
'''
9+
class Solution:
10+
def limitOccurrences(self, nums: list[int], k: int) -> list[int]:
11+
ans = []
12+
13+
for i in nums:
14+
if len([j for j in ans if j == i]) == k:
15+
continue
16+
ans.append(i)
17+
18+
return ans

0 commit comments

Comments
 (0)