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 算法题解:链表与二叉树相关问题 打打卡
算法·leetcode·链表
算法_小学生3 小时前
LeetCode 75. 颜色分类(荷兰国旗问题)
算法·leetcode·职场和发展
算法_小学生3 小时前
LeetCode 287. 寻找重复数(不修改数组 + O(1) 空间)
数据结构·算法·leetcode
岁忧3 小时前
(LeetCode 每日一题) 1865. 找出和为指定值的下标对 (哈希表)
java·c++·算法·leetcode·go·散列表
alphaTao3 小时前
LeetCode 每日一题 2025/6/30-2025/7/6
算法·leetcode·职场和发展
ゞ 正在缓冲99%…3 小时前
leetcode67.二进制求和
算法·leetcode·位运算
YuTaoShao3 小时前
【LeetCode 热题 100】240. 搜索二维矩阵 II——排除法
java·算法·leetcode
Tanecious.5 小时前
LeetCode 876. 链表的中间结点
算法·leetcode·链表
Two_brushes.13 小时前
【算法】宽度优先遍历BFS
算法·leetcode·哈希算法·宽度优先
凌肖战1 天前
力扣网编程55题:跳跃游戏之逆向思维
算法·leetcode