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
相关推荐
To_OC6 小时前
LC 131 分割回文串:刚学回溯时,我连怎么切字符串都想不明白
javascript·算法·leetcode
旖-旎7 小时前
LeetCode 518:零钱兑换||(完全背包)—— 题解
c++·算法·leetcode·动态规划·背包问题
To_OC7 小时前
LC 42 接雨水:暴力超时卡半天?前后缀数组一用就通了
javascript·算法·leetcode
tachibana218 小时前
hot100 数组中的第K个最大元素(215)
java·数据结构·算法·leetcode
晚笙coding20 小时前
LeetCode 98:验证二叉搜索树 —— 从局部判断到全局范围约束的递归思想
算法·leetcode·职场和发展
兰令水21 小时前
hot100【acm版】【2026.7.21打卡-java版本】
java·开发语言·算法·leetcode·面试
退休倒计时1 天前
【每日一题】LeetCode 131. 分割回文串 TypeScript
算法·leetcode·typescript
旖-旎2 天前
LeetCode 279:完全平方数(完全背包)—— 题解
c++·算法·leetcode·动态规划·背包问题
良木林2 天前
滑动窗口 - LeetCode hot 100
javascript·算法·leetcode·双指针·滑动窗口
晚笙coding2 天前
LeetCode 108:将有序数组转换为二叉搜索树 —— 从数组到平衡二叉树的递归构造
数据结构·算法·leetcode