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
相关推荐
夏鹏今天学习了吗42 分钟前
【LeetCode热题100(46/100)】从前序与中序遍历序列构造二叉树
算法·leetcode·职场和发展
吃着火锅x唱着歌43 分钟前
LeetCode 2389.和有限的最长子序列
算法·leetcode·职场和发展
一只鱼^_4 小时前
第 167 场双周赛 / 第 471 场周赛
数据结构·b树·算法·leetcode·深度优先·近邻算法·迭代加深
而后笑面对10 小时前
力扣2025.10.19每日一题
算法·leetcode·职场和发展
·白小白11 小时前
力扣(LeetCode) ——11.盛水最多的容器(C++)
c++·算法·leetcode
玩镜的码农小师兄14 小时前
[从零开始面试算法] (04/100) LeetCode 136. 只出现一次的数字:哈希表与位运算的巅峰对决
c++·算法·leetcode·面试·位运算·hot100
无敌最俊朗@1 天前
数组-力扣hot56-合并区间
数据结构·算法·leetcode
码农多耕地呗1 天前
力扣94.二叉树的中序遍历(递归and迭代法)(java)
数据结构·算法·leetcode
微笑尅乐1 天前
BFS 与 DFS——力扣102.二叉树的层序遍历
leetcode·深度优先·宽度优先
白云千载尽1 天前
leetcode 912.排序数组
算法·leetcode·职场和发展