当前位置:网站首页>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;
}边栏推荐
- HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
- Compressed storage of special matrices
- 腾讯云【Hiflow】新时代自动化工具
- Tencent Cloud [Hiflow] New Era Automation Tool
- 21天学习挑战赛(2)图解设备树的使用
- torch.roll()
- 金仓数据库如何验证安装文件平台正确性
- Note that Weifang generally needs to pay attention to issuing invoices
- Likou - preorder traversal, inorder traversal, postorder traversal of binary tree
- tree table lookup
猜你喜欢

云原生(三十二) | Kubernetes篇之平台存储系统介绍
![[Qixi Festival] Romantic Tanabata, code teaser.Turn love into a gorgeous three-dimensional scene and surprise her (him)!(send code)](/img/10/dafea90158adf9d43c4f025414fef7.png)
[Qixi Festival] Romantic Tanabata, code teaser.Turn love into a gorgeous three-dimensional scene and surprise her (him)!(send code)

Step by step how to perform data risk assessment

金仓数据库如何验证安装文件平台正确性

【 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

Countdown to 2 days|Cloud native Meetup Guangzhou Station, waiting for you!

ASP.NET应用程序--Hello World
![[Solved] Unity Coroutine coroutine is not executed effectively](/img/ab/035ef004a561fb98d3dd1d7d8b5618.png)
[Solved] Unity Coroutine coroutine is not executed effectively

Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium

Matlab drawing 3
随机推荐
Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
Intersection of Boolean Operations in SuperMap iDesktop.Net - Repairing Complex Models with Topological Errors
undo问题
2022-08-04 第六小组 瞒春 学习笔记
1667. 修复表中的名字
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1
627. Change of gender
HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
1873. 计算特殊奖金
2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
为什么pca分量没有关联
The design idea of DMicro, the Go microservice development framework
Summary of domestic environments supported by SuperMap
.NET Application -- Helloworld (C#)
解决端口占用问题 Port xxxx was already in use
J9 Digital Currency: What is the creator economy of web3?
【Daily Training】1403. Minimum Subsequence in Non-Increasing Order
Syntax basics (variables, input and output, expressions and sequential statements)
【滤波跟踪】基于matlab无迹卡尔曼滤波惯性导航+DVL组合导航【含Matlab源码 2019期】