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
相关推荐
愚润求学8 小时前
【动态规划】01背包问题
c++·算法·leetcode·动态规划
dying_man11 小时前
LeetCode--44.通配符匹配
算法·leetcode
Paper Clouds12 小时前
代码随想录|图论|15并查集理论基础
数据结构·算法·leetcode·深度优先·图论
GGBondlctrl13 小时前
【leetcode】字符串,链表的进位加法与乘法
算法·leetcode·链表·字符串相加·链表相加·字符串相乘
打野二师兄14 小时前
LeetCode经典题解:21、合并两个有序链表
算法·leetcode·链表
前端拿破轮14 小时前
腾讯面试官:听说你在字节面试用栈实现队列,那怎么用队列实现栈呢?
算法·leetcode·面试
Y1nhl1 天前
力扣_二叉树的BFS_python版本
python·算法·leetcode·职场和发展·宽度优先
Owen_Q1 天前
Leetcode百题斩-二分搜索
算法·leetcode·职场和发展
zstar-_1 天前
Claude code在Windows上的配置流程
笔记·算法·leetcode
??tobenewyorker2 天前
力扣打卡第23天 二叉搜索树中的众数
数据结构·算法·leetcode