当前位置:网站首页>2022.4.22-----leetcode.396
2022.4.22-----leetcode.396
2022-04-23 01:44:00 【路Lu727】
//超时了找规律。。
public int maxRotateFunction(int[] nums) {
int n=nums.length;
int all=0;
int sum=0;
for(int i=0,j=0;i<n;i++,j++){
sum+=j*nums[i];
all+=nums[i];
}
int max=sum;
for(int i=1;i<n;i++){
sum=sum+all-n*nums[n-i];
max=Math.max(max,sum);
}
return max;
}
版权声明
本文为[路Lu727]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_60466670/article/details/124346402
边栏推荐
- 2022第六季完美童模 IPA國民賽領跑元宇宙賽道
- Redis implements distributed locks
- LSF的使用方法总结
- JSP basic knowledge summary
- 电子采购如何成为供应链中的增值功能?
- Longest common subsequence (record path version)
- VSCODE + PHP Debug + 名字空间指引
- (product resources) mingdeyang ad8488 module high performance digital X-ray FMC interface 128 analog channel high-speed ADC chip
- 修改数组(并查集)
- Instructions for Jerry's reset IO maintenance level [chapter]
猜你喜欢

电子采购如何成为供应链中的增值功能?

Chapter 6 uses Matplotlib to draw thermodynamic diagram

Realize the function of progress bar through layerdrawable

无关联进程间通信 —— 命名管道的创建和使用

关于C4D动画如何导入Lumion

JSP basic knowledge summary

01 knapsack problem - and deformation problem

Dimension C China helping farmers in rural areas warms people's hearts the third stop is jiabaoguo farm

Vscode + PHP debug + namespace guidelines

Server 2019 the available memory of the server is half of the actual memory
随机推荐
W801 / w800 / w806 unique ID / CPUID / flashid
LSF的常用使用命令总结
计蒜客:等边三角形(DFS)
The most understandable life cycle of dependency injection
Instructions for Jerry's reset IO maintenance level [chapter]
42、使用mmrotate中k3det进行旋转目标检测,并进行mnn部署和ncnn部署
计蒜客:方程的解数
mb_ substr()、mb_ Strpos() function (story)
How to install mysql-5.7.9 in RPM mode under Linux system
Find number (DFS)
Introduction to PCIe xdma IP core (with list) - mingdeyang science and Education (mdy edu. Com)
What are the benefits of writing unit tests using the unit test framework?
四级城市地区表 xlsx, sql文件,国内,中国省市县街道乡镇四级地址 (名称,联动ID,层级,是否末级(1-是))
Ziguang micro financial report is outstanding. What does the triple digit growth of net profit in 2021 depend on
Gbase 8s fragment table management operation
VSCODE + PHP Debug + 名字空间指引
C语言中如何“指名道姓”的进行初始化
[Blue Bridge Cup] [10th real topic in 2019] priority of takeout shop
Do447 manage user and team access
DFS parity pruning