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
相关推荐
6Hzlia5 小时前
【Hot 100 刷题计划】 LeetCode 48. 旋转图像 | C++ 矩阵变换题解
c++·leetcode·矩阵
Morwit6 小时前
【力扣hot100】 1. 两数之和
数据结构·c++·算法·leetcode·职场和发展
py有趣7 小时前
力扣热门100题之岛屿的数量(DFS/BFS经典题)
leetcode·深度优先·宽度优先
qinian_ztc8 小时前
frida 14.2.18 安装报错解决
算法·leetcode·职场和发展
田梓燊9 小时前
2026/4/11 leetcode 3741
数据结构·算法·leetcode
小肝一下11 小时前
每日两道力扣,day8
c++·算法·leetcode·哈希算法·hot100
语戚13 小时前
力扣 51. N 皇后:基础回溯、布尔数组优化、位运算全解(Java 实现)
java·算法·leetcode·力扣·剪枝·回溯·位运算
py有趣13 小时前
力扣热门100题之螺旋矩阵
算法·leetcode
人道领域14 小时前
【LeetCode刷题日记】383 赎金信
算法·leetcode·职场和发展
旖-旎14 小时前
哈希表(存在重复元素)(3)
数据结构·c++·学习·算法·leetcode·散列表