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 207 & 210 & 630 & 1462)
算法·leetcode·拓扑排序·反悔贪心·三色标记法
老鼠只爱大米7 分钟前
LeetCode算法题详解 15:三数之和
算法·leetcode·双指针·三数之和·分治法·three sum
菜鸟233号22 分钟前
力扣416 分割等和子串 java实现
java·数据结构·算法·leetcode
Swift社区28 分钟前
LeetCode 469 凸多边形
算法·leetcode·职场和发展
圣保罗的大教堂30 分钟前
leetcode 1458. 两个子序列的最大点积 困难
leetcode
Dream it possible!32 分钟前
LeetCode 面试经典 150_二分查找_搜索二维矩阵(112_74_C++_中等)
leetcode·面试·矩阵
求梦82041 分钟前
【力扣hot100题】缺失的第一个正数(12)
数据结构·算法·leetcode
黎雁·泠崖1 小时前
二叉树实战进阶全攻略:从层序遍历到OJ题深度解析
c语言·数据结构·leetcode
千金裘换酒1 小时前
LeetCode 回文链表
算法·leetcode·链表
老鼠只爱大米1 小时前
LeetCode算法题详解 283:移动零
算法·leetcode·双指针·快慢指针·移动零·move zeroes