怪怪的题目
感觉有一些更聪明的解法==
应该至少可以binary search吧
不过有点懒得改了
def maxCount(self, banned: List[int], n: int, maxSum: int) -> int:
banned = set(banned)
cur_sum, cur_cnt = 0, 0
for i in range(1,n+1):
if i in banned:
continue
cur_sum += i
if cur_sum>maxSum:
return cur_cnt
cur_cnt += 1
return cur_cnt