好难啊。 我之前尝试用递归失败了, 最后写了个循环的 class Solution: def upper_bound_(self , n , v , a ): # write code here low, high = 0 , n-1 res = n + 1 while low <= high: mid = (high - low) // 2 + low num = a[mid] if num < v: ...