当前位置:网站首页>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;}};
边栏推荐
- AOSP内置APP特许权限白名单
- leetcode:254. 因子的组合
- 如何确定异步 I/O 瓶颈
- Crawler - action chain, xpath, coding platform use
- Qt的QItemDelegate使用
- 编译型与解释型编程语言的区别
- 阴影初始化【5】
- B.构造一个简单的数列(贪心)
- 关于redis的几件小事(五)redis保证高并发以及高可用
- 【 HMS core 】 【 Media 】 online video editing service 】 【 material can't show, or network anomalies have been Loading state
猜你喜欢
随机推荐
[in-depth study of 4 g / 5 g / 6 g project - 50] : URLLC - 16 - the 3 GPP URLLC agreement, specification, technical principle of depth interpretation - 10 - high reliability technology - 1 - low codin
Database recovery
Chinese valentine's day, of course, to learn SQL optimization better leave work early to find objects
量化细胞内的信息流:机器学习时代下的研究进展
期货开户之前要谈好最低手续费和交返
Lecture 4 SVN
【模型部署与业务落地】基于量化芯片的损失分析
手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果
MySQL【窗口函数】【共用表表达式】
【剑指offer59】队列的最大值
广告电商系统开发功能只订单处理
砺夏行动|九州云章津楠:开源不是少数人的运动,大众化才是源泉
OAID是什么
集合划分差最小问题(01背包)
[The Art of Hardware Architecture] Study Notes (1) The World of Metastability
[Opportunity Enlightenment-60]: "Soldiers, Stupid Ways"-1- Opening: "Death" and "Life" are the way of heaven
【HMS core】【Media】【视频编辑服务】 在线素材无法展示,一直Loading状态或是网络异常
特殊品种的二次开户验资金额
考研上岸又转行软件测试,从5k到13k完美逆袭,杭州校区小哥哥拒绝平庸终圆梦!
Cisco-小型网络拓扑(DNS、DHCP、网站服务器、无线路由器)