这题是周赛的题目。
我的思路很简单,按升序累加数字,当下一个数字小于或者等于的时候,把结果返回到一个新数组去,并重置再来。
class Solution:
def maxAscendingSum(self, nums: List[int]) -> int:
all=[]
start=0
for i in range(len(nums)):
start+=nums[i]
try:
if nums[i] - nums[i + 1] >= 0:
all.append(start)
start=0
except:
all.append(start)
return max(all)
用了try,except,感觉是有点取巧的写法。
速度还行
拍拍
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hello there,
I hope you can help me out. I tried to register a user at https://follow.steems.top/ , but somehow, I didn't copy correctly the password given me upon registration. So, when I tried to change the password or log in with it, I couldn't do so. I tried to revoke access to steems.top in order to register once again, but I only receive a message, that the user has already been created. As a result, I am unable to log in with my account.
Is there a way to fix this?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit