Skip to content

Commit ca61763

Browse files
rimgosuheyhyo11
authored andcommitted
3978
1 parent 3efd103 commit ca61763

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
'''
3+
1. 아이디어 :
4+
middle 원소 구하고, 그 원소가 유일한지 확인한다.
5+
6+
2. 시간복잡도 :
7+
o(n)
8+
3. 자료구조/알고리즘 :
9+
'''
10+
11+
12+
class Solution:
13+
def isMiddleElementUnique(self, nums: list[int]) -> bool:
14+
n = len(nums)
15+
middle = nums[n//2]
16+
return True if 1 == len([i for i in nums if i == middle]) else False

0 commit comments

Comments
 (0)