当前位置:网站首页>2022.8.4-----leetcode.1403
2022.8.4-----leetcode.1403
2022-08-05 03:08:00 【路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;
}边栏推荐
- 2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
- Linux下常见的开源数据库,你知道几个?
- 22-07-31周总结
- Hash table lookup (hash table)
- (11) Metaclass
- Ant Sword Advanced Module Development
- IJCAI2022 | DictBert: Pre-trained Language Models with Contrastive Learning for Dictionary Description Knowledge Augmentation
- Talking about data security governance and privacy computing
- tree table lookup
- 【七夕节】浪漫七夕,代码传情。将爱意变成绚烂的立体场景,给她(他)一个惊喜!(送代码)
猜你喜欢

Use SuperMap iDesktopX data migration tool to migrate map documents and symbols

使用二维码传输文件的小工具 - QFileTrans 1.2.0.1

In 2022, you still can't "low code"?Data science can also play with Low-Code!

QT语言文件制作

告白数字化转型时代,时速云镌刻价值新起点

Multithreading (2)

QT MV\MVC structure

The second council meeting of the Dragon Lizard Community was successfully held!Director general election, 4 special consultants joined

毕设-基于SSM房屋租赁管理系统

为什么pca分量没有关联
随机推荐
Linux下常见的开源数据库,你知道几个?
The Tanabata copywriting you want has been sorted out for you!
Tencent Cloud [Hiflow] New Era Automation Tool
Solve the problem of port occupancy Port xxxx was already in use
Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
[Filter tracking] based on matlab unscented Kalman filter inertial navigation + DVL combined navigation [including Matlab source code 2019]
The pit of std::string::find return value
(11) Metaclass
优炫数据库的单节点如何转集群
torch.roll()
2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
Physical backup issues caused by soft links
[In-depth study of 4G/5G/6G topic-51]: URLLC-16-"3GPP URLLC related protocols, specifications, and technical principles in-depth interpretation"-11-High reliability technology-2-Link adaptive enhancem
The design idea of DMicro, the Go microservice development framework
腾讯云【Hiflow】新时代自动化工具
论治理与创新,2022 开放原子全球开源峰会 OpenAnolis 分论坛圆满落幕
沃谈小知识 |“远程透传”那点事儿
Simple description of linked list and simple implementation of code
数据增强Mixup原理与代码解读
Matlab drawing 3