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
相关推荐
木子墨5164 小时前
LeetCode 热题 100 精讲 | 并查集篇:最长连续序列 · 岛屿数量 · 省份数量 · 冗余连接 · 等式方程的可满足性
数据结构·c++·算法·leetcode
故事和你919 小时前
洛谷-算法1-7-搜索3
数据结构·c++·算法·leetcode·动态规划
y = xⁿ12 小时前
20天速通LeetCode day07:前缀和
数据结构·算法·leetcode
小雅痞12 小时前
[Java][Leetcode hard] 42. 接雨水
java·开发语言·leetcode
北顾笙98014 小时前
day26-数据结构力扣
数据结构·算法·leetcode
故事和你9114 小时前
洛谷-数据结构1-2-二叉树1
开发语言·数据结构·c++·算法·leetcode·动态规划·图论
_日拱一卒14 小时前
LeetCode:19删除链表的倒数第N个节点
算法·leetcode·链表
y = xⁿ15 小时前
20天速通LeetCode day08:关于栈
算法·leetcode·职场和发展
XWalnut15 小时前
LeetCode刷题 day13
数据结构·算法·leetcode
im_AMBER17 小时前
Leetcode 158 数组中的第K个最大元素 | 查找和最小的 K 对数字
javascript·数据结构·算法·leetcode·