Skip to content

Commit 70716f7

Browse files
committed
110425
1 parent 037c2ae commit 70716f7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
from typing import List, Optional
2-
from functools import cache
1+
from typing import List
2+
33

44
# leetcode submit region begin(Prohibit modification and deletion)
55
class Solution:
66
def minOperations(self, nums: List[int], k: int) -> int:
7-
7+
nlist = list(sorted(set(nums)))
8+
if nlist[0] < k:
9+
return -1
10+
if nlist[0] == k:
11+
return len(nlist) - 1
12+
return len(nlist)
13+
14+
815
# leetcode submit region end(Prohibit modification and deletion)
916

1017

1118
class MinimumOperationsToMakeArrayValuesEqualToK(Solution):
12-
pass
19+
pass

0 commit comments

Comments
 (0)