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
相关推荐
AlenTech4 小时前
155. 最小栈 - 力扣(LeetCode)
算法·leetcode·职场和发展
坚持不懈的大白5 小时前
Leetcode学习笔记
笔记·学习·leetcode
Tisfy7 小时前
LeetCode 3047.求交集区域内的最大正方形面积:2层循环暴力枚举
算法·leetcode·题解·模拟·枚举·几何
栈与堆8 小时前
LeetCode 21 - 合并两个有序链表
java·数据结构·python·算法·leetcode·链表·rust
鹿角片ljp8 小时前
力扣7.整数反转-从基础到边界条件
算法·leetcode·职场和发展
java修仙传8 小时前
力扣hot100:前K个高频元素
算法·leetcode·职场和发展
爱编码的傅同学11 小时前
【今日算法】Leetcode 581.最短无序连续子数组 和 42.接雨水
数据结构·算法·leetcode
YuTaoShao12 小时前
【LeetCode 每日一题】2053. 数组中第 K 个独一无二的字符串
算法·leetcode·职场和发展
毅炼12 小时前
hot100打卡——day09
java·leetcode
想逃离铁厂的老铁13 小时前
Day42 >> 188、买卖股票的最佳时机IV + 309.最佳买卖股票时机含冷冻期 + 714.买卖股票的最佳时机含手续费
算法·leetcode·职场和发展