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
相关推荐
sheeta199816 小时前
LeetCode 每日一题笔记 日期:2026.05.12 题目:1665. 完成所有任务的最少初始能量
笔记·算法·leetcode
khalil102016 小时前
代码随想录算法训练营Day-49 图论01 | 图论理论基础、深搜理论基础、98. 所有可达路径、广搜理论基础
c++·算法·leetcode·深度优先·图论
吃着火锅x唱着歌17 小时前
LeetCode 726.原子的数量
linux·算法·leetcode
玛卡巴卡ldf17 小时前
【LeetCode 手撕算法】(栈)有效括号、最小栈、字符串解码、每日温度、柱状图最大矩形
java·数据结构·算法·leetcode·力扣
_深海凉_17 小时前
LeetCode热题100-两两交换链表中的节点
算法·leetcode·链表
铁皮哥19 小时前
【力扣题解】LeetCode 25. K 个一组翻转链表
java·数据结构·windows·python·算法·leetcode·链表
洛水水20 小时前
【力扣100题】29. 对称二叉树
算法·leetcode·职场和发展
洛水水20 小时前
【力扣100题】26. 二叉树的中序遍历
算法·leetcode·深度优先
sheeta199820 小时前
LeetCode 每日一题笔记 日期:2026.05.11 题目:2553. 分割数组中数字的数位
笔记·算法·leetcode
我爱cope21 小时前
【滑动窗口:力扣438找到字符串中所有字母异位词】
算法·leetcode·职场和发展