5531. 特殊数组的特征值

    科技2022-07-17  101

    5531. 特殊数组的特征值

    传送门

    传送门

    题意

    结题思路

    # 思路1: # 遍历数组,模拟判断。 class Solution(object): def specialArray(self, nums): """ :type nums: List[int] :rtype: int """ len1 = len(nums) for i in range(1, len1+1): count = 0 # 有几个元素大于或者等于nums[i] for j in range(len1): if(nums[j] >= i): count += 1 if(count == i): return i return -1
    Processed: 0.010, SQL: 8