2640. Find the Score of All Prefixes of an Array

2640. Find the Score of All Prefixes of an Array

python 复制代码
class Solution:
    def findPrefixScore(self, nums: List[int]) -> List[int]:
        conver=[nums[0]*2]
        premax=nums[0]
        for i in range(1,len(nums)):
            premax=max(premax,nums[i])
            conver.append(conver[-1]+premax+nums[i])
        return conver
相关推荐
.普通人2 小时前
c语言--力扣简单题目(链表的中间节点)讲解
c语言·leetcode·链表
__AtYou__2 小时前
Golang | Leetcode Golang题解之第412题Fizz Buzz
leetcode·golang·题解
源代码•宸5 小时前
Leetcode—322. 零钱兑换【中等】(memset(dp,0x3f, sizeof(dp))
c++·算法·leetcode·职场和发展·dp
戊子仲秋9 小时前
【LeetCode】每日一题 2024_9_13 预算内的最多机器人数目(滑动窗口、单调队列)
算法·leetcode
Chase-Hart10 小时前
【每日一题】LeetCode 7.整数反转(数学)
java·数据结构·算法·leetcode·eclipse
MogulNemenis11 小时前
力扣100题——贪心算法
算法·leetcode·贪心算法
Rivieres14 小时前
算法入门-贪心1
java·算法·leetcode·推荐算法
原来你也是码农1 天前
(滑动窗口) LeetCode. 2398 预算内的最多机器人数目
数据结构·c++·算法·leetcode
醉后才知酒浓1 天前
三数之和--力扣15
算法·leetcode·职场和发展
伏城之外1 天前
LeetCode - 17 电话号码的字母组合
java·javascript·c++·python·leetcode·c