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
相关推荐
蛋蛋的就会顺顺的4 小时前
hot100 p0——栈,贪心算法,动态规划
java·前端·javascript·算法·leetcode·力扣
Navigator_Z6 小时前
LeetCode //C - 1291. Sequential Digits
c语言·算法·leetcode
0+11111 小时前
算法 --栈
算法·leetcode
圣保罗的大教堂11 小时前
leetcode 3723. 数位平方和的最大值 中等
leetcode
浅念-13 小时前
动态规划:线性DP——多状态DP与子数组专题笔记
c++·笔记·算法·leetcode·职场和发展·动态规划·力扣
学电子她就能回来吗14 小时前
LeetCode Hot 100|滑动窗口专题零基础学习笔记
笔记·学习·leetcode
拾饵94215 小时前
面试回答整理(Q1–Q3)
leetcode
虚无的纽扣16 小时前
【力扣刷题】第四天:三数之和、四数之和
算法·leetcode·职场和发展
_不会dp不改名_16 小时前
leetcode_3273 数位平方和的最大值
算法·leetcode·职场和发展
局部有解17 小时前
Leetcode - 42 接雨水(一维)
数据结构·c++·算法·leetcode