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
相关推荐
阿里嘎多哈基米1 小时前
速通Hot100-Day09——二叉树
算法·leetcode·二叉树·hot100
Frostnova丶1 小时前
LeetCode 48 & 1886.矩阵旋转与判断
算法·leetcode·矩阵
多打代码1 小时前
2026.3.22 回文子串
算法·leetcode·职场和发展
im_AMBER2 小时前
Leetcode 144 位1的个数 | 只出现一次的数字
学习·算法·leetcode
小刘不想改BUG2 小时前
LeetCode 138.随机链表的复制 Java
java·leetcode·链表·hash table
参.商.3 小时前
【Day43】49. 字母异位词分组
leetcode·golang
参.商.3 小时前
【Day45】647. 回文子串 5. 最长回文子串
leetcode·golang
Trouvaille ~3 小时前
【优选算法篇】哈希表——空间换时间的极致艺术
c++·算法·leetcode·青少年编程·蓝桥杯·哈希算法·散列表
我是咸鱼不闲呀4 小时前
力扣Hot100系列22(Java)——[图论]总结(岛屿数量,腐烂的橘子,课程表,实现Trie(前缀树))
java·leetcode·图论
阿Y加油吧5 小时前
力扣打卡——搜索二维矩阵、相交链表
线性代数·leetcode·矩阵