当前位置:网站首页>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
边栏推荐
猜你喜欢
When should I write unit tests? What is TDD?
Completely uninstall antidote 10? What if the antidote uninstall is not clean?
Redis implements distributed locks
Oracle database query lock table SQL script and delete lock information script (necessary for database development ETL and DBA)
W801 / w800 / w806 unique ID / CPUID / flashid
批处理多个文件合成一个HEX
W801/W800/W806唯一ID/CPUID/FLASHID
Do447 manage user and team access
Custom numeric input control
计蒜客:数独(DFS)
随机推荐
. net unit test Part 1: common Net unit test framework?
[蓝桥杯][2019年第十届真题]外卖店优先级
LSF的常用使用命令总结
腾讯云接口进行人脸检测 和签名出错问题
Linux系统下以RPM方式如何安装mysql-5.7.9
W801 / w800 WiFi socket development (II) - UDP Bluetooth control WiFi connection
2n queen problem
Vscode + PHP debug + namespace guidelines
[经验教程]支付宝余额自动转入余额宝怎么设置关闭取消支付宝余额自动转入余额宝?
Introduction to gbase 8s shared memory buffer pool
J-Link RTT使用
Tight coupling of visual wheel odometer
Ziguang micro financial report is outstanding. What does the triple digit growth of net profit in 2021 depend on
Android sqliteopenhelper data table structure upgrade
The leader / teacher asks to fill in the EXCEL form document. How to edit the word / Excel file on the mobile phone and fill in the Excel / word electronic document?
iTextSharp 显示中文字体
领导/老师让填写电子excel表格文档可手机上如何编辑word/excel文件填写excel/word电子文档?
Technology cloud report: cloud computing has entered the "second half". Where is the way out for domestic cloud?
New functions of ai2022, introduction to new functions of illustrator 2022
The most understandable life cycle of dependency injection