当前位置:网站首页>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;
}边栏推荐
- High Item 02 Information System Project Management Fundamentals
- [论文笔记] MapReduce: Simplified Data Processing on Large Clusters
- 高项 02 信息系统项目管理基础
- Everyone in China said data, you need to focus on core characteristic is what?
- Review 51 MCU
- [Solved] Unity Coroutine coroutine is not executed effectively
- 1667. Fix names in tables
- Solve the problem of port occupancy Port xxxx was already in use
- Likou - preorder traversal, inorder traversal, postorder traversal of binary tree
- MRTK3开发Hololens应用-手势拖拽、旋转 、缩放物体实现
猜你喜欢

The usage of try...catch and finally in js

Cloud Native (32) | Introduction to Platform Storage System in Kubernetes

Talking about data security governance and privacy computing

.NET Application -- Helloworld (C#)

word column notes

Data storage practice based on left-order traversal

Confessing the era of digital transformation, Speed Cloud engraves a new starting point for value

Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme

2022高处安装、维护、拆除考试题模拟考试题库及在线模拟考试

Use SuperMap iDesktopX data migration tool to migrate map documents and symbols
随机推荐
Details such as compiling pretreatment
Open-Falcon of operation and maintenance monitoring system
rpc-remote procedure call demo
Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
惨遭打脸:字节某部门竟有这么多测试员
High Item 02 Information System Project Management Fundamentals
倒计时 2 天|云原生 Meetup 广州站,等你来!
2022高处安装、维护、拆除考试题模拟考试题库及在线模拟考试
How to sort multiple fields and multiple values in sql statement
Turn: Charles Handy: Who you are is more important than what you do
数学-求和符号的性质
Why did they choose to fall in love with AI?
十五. 实战——mysql建库建表 字符集 和 排序规则
Open Source License Description LGPL
In 2022, you still can't "low code"?Data science can also play with Low-Code!
CPDA|How Operators Learn Data Analysis (SQL) from Negative Foundations
链表的简单描述及代码的简单实现
The problem of lack of dynamic library "libtinfo.so.5" in ksql application under UOS system
The linear table lookup
Summary of domestic environments supported by SuperMap