Skip to content

Commit f09fca6

Browse files
authored
Create 3978. Unique Middle Element.py
1 parent f926064 commit f09fca6

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def isMiddleElementUnique(self, nums: list[int]) -> bool:
3+
ret = 0
4+
gijun = len(nums)//2
5+
gijun = nums[gijun]
6+
7+
for n in nums:
8+
if n == gijun:
9+
ret+=1
10+
11+
if ret == 1:
12+
return True
13+
else:
14+
return False

0 commit comments

Comments
 (0)