当前位置:网站首页>1403. Minimum Subsequence in Non-Increasing Order
1403. Minimum Subsequence in Non-Increasing Order
2022-08-04 14:36:00 【anieoo】
Original title link: 1403. Minimum subsequence in non-increasing order
solution:
class Solution {public:vector minSubsequence(vector& nums) {sort(nums.begin(), nums.end());int sum = 0;for(auto &x : nums) sum += x;vector res; //return valueint s = 0,j = nums.size() - 1;while(j >= 0 && s <= sum / 2) {res.push_back(nums[j]);s += nums[j--];}return res;}};
边栏推荐
- 蓝牙技术|上半年全国新增 130 万台充电桩,蓝牙充电桩将成为市场主流
- 异步编程概览
- Centos7 install mysql version rapidly
- 从理论到实践:MySQL性能优化和高可用架构,一次讲清
- License server system does not support this version of this feature
- leetcode:255 验证前序遍历序列二叉搜索树
- How to write SQL statements: the usage of Update, Case, and Select together
- 开发者独立搭建一个跨模态搜索应用有多难?
- metaRTC5.0新版本支持mbedtls(PolarSSL)
- 杭电校赛(ACM组队安排)
猜你喜欢
[Beiya data recovery] IBM System Storage storage lvm information lost data recovery solution
【HMS core】【Media】【视频编辑服务】 在线素材无法展示,一直Loading状态或是网络异常
Technology sharing | Mini program realizes audio and video calls
零基础可以转行软件测试吗 ?这篇文章告诉你
基于 Next.js实现在线Excel
Lixia Action | Kyushu Yunzhang Jinnan: Open source is not a movement for a few people, popularization is the source
metaRTC5.0新版本支持mbedtls(PolarSSL)
郑轻新生校赛和中工选拔赛题解
【Today in History】August 4: First female Turing Award winner; NVIDIA acquires MediaQ; first Cybersecurity Challenge completed
Rust from entry to proficient 04-variables
随机推荐
南瓜科学产品升级 开启益智探索新篇章
【剑指offer59】队列的最大值
杭电校赛(ACM组队安排)
并发程序的隐藏杀手——假共享(False Sharing)
Theory 1: Deep Learning - Detailed Explanation of the LetNet Model
考研上岸又转行软件测试,从5k到13k完美逆袭,杭州校区小哥哥拒绝平庸终圆梦!
Unity插件:使用PopulationSystem制作行走交流的路人
leetcode:254. 因子的组合
Makefile 语法及使用笔记
eyb:JWT介绍
CF1527D MEX Tree (mex & tree & inclusive)
JCMsuite应用:倾斜平面波传播透过光阑的传输
Technology sharing | Mini program realizes audio and video calls
xampp安装包含的组件有(php,perl,apche,mysql)
Almost all known protein structures in the world are open sourced by DeepMind
Android Sqlite3 basic commands
Set partition minimum difference problem (01 knapsack)
用于X射线聚焦的复合折射透镜
特殊品种的二次开户验资金额
七夕邂逅爱,那人一定在