Skip to content

Commit 085ae1a

Browse files
Time: 555 ms (92.73%) | Memory: 31.9 MB (10.30%) - LeetSync
1 parent dcd1f00 commit 085ae1a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def minOperations(self, nums: List[int]) -> int:
3+
d = Counter(nums)
4+
ans = 0
5+
6+
for i in d:
7+
if d[i] == 1:
8+
return -1
9+
ans += (d[i]+2)//3
10+
11+
return ans

0 commit comments

Comments
 (0)