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
相关推荐
Hi李耶8 小时前
【LeetCode】17.电话号码的字母组合
算法·leetcode·职场和发展
Forever Nore18 小时前
LeetCode 4 寻找两个正序数组的中位数 - 二分
算法·leetcode
evans在进步1 天前
LeetCode 200:岛屿数量——Java DFS 染色法详解
java·leetcode·深度优先
旖旎夜光1 天前
LeetCode 202:快乐数(双指针问题) —— 题解
数据结构·c++·算法·leetcode·双指针
君君思密达1 天前
Leetcode Hot 100 题目详解-哈希表
数据结构·算法·leetcode
203号居民1 天前
LeetCode hot 100 —560. 和为 K 的子数组
java·算法·leetcode
退休倒计时1 天前
【每日一题】LeetCode 20. 有效的括号 TypeScript
算法·leetcode·职场和发展·typescript
.道阻且长.1 天前
3.LeetCode算法习题讲解--双指针--快乐数
算法·leetcode·职场和发展
Forever Nore1 天前
LeetCode 5 最长回文子串 - 中心扩散
linux·算法·leetcode
Forever Nore1 天前
LeetCode 6 Z 字形变换 - 按行模拟
算法·leetcode