当前位置:网站首页>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;
}
边栏推荐
- (十一)元类
- Summary of domestic environments supported by SuperMap
- 【Daily Training】1403. Minimum Subsequence in Non-Increasing Order
- J9 Digital Currency: What is the creator economy of web3?
- 基于生长的棋盘格角点检测方法
- QT:神奇QVarient
- Likou - preorder traversal, inorder traversal, postorder traversal of binary tree
- In 2022, you still can't "low code"?Data science can also play with Low-Code!
- How to Add Category-Specific Widgets in WordPress
- From "useable" to "easy to use", domestic software is self-controllable and continues to advance
猜你喜欢
Flink 1.15.1 Cluster Construction (StandaloneSession)
【 genius_platform software platform development 】 : seventy-six vs the preprocessor definitions written cow force!!!!!!!!!!(in the other groups conding personnel told so cow force configuration to can
Step by step how to perform data risk assessment
云原生(三十二) | Kubernetes篇之平台存储系统介绍
论治理与创新,2022 开放原子全球开源峰会 OpenAnolis 分论坛圆满落幕
引领数字医学高地,中山医院探索打造未来医院“新范式”
Tencent Cloud [Hiflow] New Era Automation Tool
大像素全景制作完成后,推广方式有哪些?
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
Beyond YOLO5-Face | YOLO-FaceV2 officially open source Trick+ academic point full
随机推荐
2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
(十一)元类
你要的七夕文案,已为您整理好!
How to transfer a single node of Youxuan database to a cluster
QT:神奇QVarient
Is your data safe in this hyperconnected world?
云原生(三十二) | Kubernetes篇之平台存储系统介绍
Native js realizes the effect of selecting and canceling all the multi-select boxes
2022-08-04 第六小组 瞒春 学习笔记
Multithreading (2)
Data to enhance Mixup principle and code reading
Matlab画图3
Study Notes-----Left-biased Tree
Lexicon - the maximum depth of a binary tree
.NET应用程序--Helloworld(C#)
2022高处安装、维护、拆除考试题模拟考试题库及在线模拟考试
The usage of try...catch and finally in js
静态方法获取配置文件数据
1667. Fix names in tables
Cybersecurity and the Metaverse: Identifying Weak Links