Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit 9be8cd2

Browse files
authored
Merge pull request #604 from sree-gaya3/1608_Solution_code
1608 solution code
2 parents 8eb2f5c + 167a96d commit 9be8cd2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution(object):
2+
def specialArray(self, nums):
3+
"""
4+
:type nums: List[int]
5+
:rtype: int
6+
"""
7+
nums.sort()
8+
out = -1
9+
for i in range(len(nums)):
10+
if nums[~i]>=i+1:
11+
if i==len(nums)-1 or nums[~(i+1)]<i+1:
12+
return i+1
13+
return out
14+

0 commit comments

Comments
 (0)