Skip to content

Commit f0e3492

Browse files
authored
Create count-elements-with-strictly-smaller-and-greater-elements.py
1 parent 6b65ff6 commit f0e3492

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Time: O(n)
2+
# Space: O(1)
3+
4+
# math
5+
class Solution(object):
6+
def countElements(self, nums):
7+
"""
8+
:type nums: List[int]
9+
:rtype: int
10+
"""
11+
mn = min(nums)
12+
mx = max(nums)
13+
return sum(mn < x < mx for x in nums)

0 commit comments

Comments
 (0)