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 分钟前
【码道初阶】【LeetCode 958】判定完全二叉树:警惕 BFS 中的“管中窥豹”陷阱
算法·leetcode·宽度优先
月明长歌1 小时前
【码道初阶】【LeetCode 102】二叉树层序遍历:如何利用队列实现“一层一层切蛋糕”?
java·数据结构·算法·leetcode·职场和发展·队列
yaoh.wang2 小时前
力扣(LeetCode) 66: 加一 - 解法思路
python·程序人生·算法·leetcode·面试·职场和发展·跳槽
长安er3 小时前
LeetCode 01 背包 & 完全背包 题型总结
数据结构·算法·leetcode·动态规划·背包问题
小南家的青蛙3 小时前
LeetCode第2658题 - 网格图中鱼的最大数目
算法·leetcode·职场和发展
夏鹏今天学习了吗5 小时前
【LeetCode热题100(73/100)】买卖股票的最佳时机
算法·leetcode·职场和发展
Voyager_45 小时前
算法学习记录17——力扣“股票系列题型”
学习·算法·leetcode
XFF不秃头5 小时前
【力扣刷题笔记-在排序数组中查找元素的第一个和最后一个位置】
c++·笔记·算法·leetcode
im_AMBER6 小时前
Leetcode 79 最佳观光组合
笔记·学习·算法·leetcode
练习时长一年6 小时前
在排序数组中查找元素的第一个和最后一个位置
数据结构·算法·leetcode