当前位置:网站首页>2022.8.4-----leetcode.1403
2022.8.4-----leetcode.1403
2022-08-05 03:19:00 【Road Lu727】
public List<Integer> minSubsequence(int[] nums) {
int n=nums.length;
List<Integer> ans=new ArrayList<>();
int sum=0;
for(int i=0;i<n;i++){
sum+=nums[i];
}
Arrays.sort(nums);
int tmp=0;
for(int i=n-1;i>=0;i--){
tmp+=nums[i];
ans.add(nums[i]);
if(tmp>sum/2)
break;
}
return ans;
}
边栏推荐
- After the large pixel panorama is completed, what are the promotion methods?
- Distributed systems revisited: there will never be a perfect consistency scheme...
- 2022高处安装、维护、拆除考试题模拟考试题库及在线模拟考试
- Countdown to 2 days|Cloud native Meetup Guangzhou Station, waiting for you!
- Syntax basics (variables, input and output, expressions and sequential statement completion)
- Talking about data security governance and privacy computing
- Everyone in China said data, you need to focus on core characteristic is what?
- ffmpeg pixel format basics
- 1667. Fix names in tables
- 惨遭打脸:字节某部门竟有这么多测试员
猜你喜欢
Question about #sql shell#, how to solve it?
链表的简单描述及代码的简单实现
Open-Falcon of operation and maintenance monitoring system
人人都在说的数据中台,你需要关注的核心特点是什么?
金仓数据库如何验证安装文件平台正确性
大像素全景制作完成后,推广方式有哪些?
How to Add Category-Specific Widgets in WordPress
Why did they choose to fall in love with AI?
Multithreading (2)
Everyone in China said data, you need to focus on core characteristic is what?
随机推荐
Why is the pca component not associated
sql server 安装提示用户名不存在
今年七夕,「情蔬」比礼物更有爱
Study Notes-----Left-biased Tree
QT MV\MVC structure
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
Use SuperMap iDesktopX data migration tool to migrate map documents and symbols
.NET应用程序--Helloworld(C#)
你要的七夕文案,已为您整理好!
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1
【已解决】Unity Coroutinue 协程未有效执行的问题
Leading the highland of digital medicine, Zhongshan Hospital explores to create a "new paradigm" for future hospitals
Confessing the era of digital transformation, Speed Cloud engraves a new starting point for value
.NET Application -- Helloworld (C#)
PostgreSQL数据库 用navicat 打开表结构的时候报错 cannot update secondarysnapshot during a parallel operation 怎么解决?
Programmer's Tanabata Romantic Moment
After the large pixel panorama is completed, what are the promotion methods?
【七夕节】浪漫七夕,代码传情。将爱意变成绚烂的立体场景,给她(他)一个惊喜!(送代码)
AI + Small Nucleic Acid Drugs | Eleven Completes $22 Million Seed Round Financing
Talking about data security governance and privacy computing