当前位置:网站首页>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;}}; 边栏推荐
- 零基础可以转行软件测试吗 ?这篇文章告诉你
- [机缘参悟-60]:《兵者,诡道也》-1-开篇:“死“与“生“都是天道
- Problem solving-->Online OJ (18)
- Rust from entry to proficient 04-variables
- 属于程序猿的浪漫
- 南瓜科学产品升级 开启益智探索新篇章
- Bluetooth Technology|In the first half of the year, 1.3 million charging piles were added nationwide, and Bluetooth charging piles will become the mainstream of the market
- License server system does not support this version of this feature
- eNSP-小型网络拓扑(DNS、DHCP、网站服务器、无线路由器)
- 编译型与解释型编程语言的区别
猜你喜欢

ICML 2022 | 图神经网络的局部增强

metaRTC5.0新版本支持mbedtls(PolarSSL)

Bluetooth Technology|In the first half of the year, 1.3 million charging piles were added nationwide, and Bluetooth charging piles will become the mainstream of the market

Crawler - basic use of selenium, no interface browser, other uses of selenium, cookies of selenium, crawler cases

【Today in History】August 4: First female Turing Award winner; NVIDIA acquires MediaQ; first Cybersecurity Challenge completed

NPDP|作为产品经理,如何快速提升自身业务素养?

零基础可以转行软件测试吗 ?这篇文章告诉你

考研上岸又转行软件测试,从5k到13k完美逆袭,杭州校区小哥哥拒绝平庸终圆梦!

Sum of four squares, laser bombs

Redis 复习计划 - Redis主从数据一致性和哨兵机制
随机推荐
Oracle RAC环境下vip/public/private IP的区别
B.构造一个简单的数列(贪心)
Find My技术|防止你的宠物跑丢,苹果Find My技术可以帮到你
物联网应用发展趋势
自监督学习未来是掩码自编码器?KAIST最新《自监督学习掩码自编码器》研究进展
CCF GLCC officially opened | Kyushu Cloud open source experts bring generous bonuses to help universities promote open source
如何和程序员谈恋爱
Android Sqlite3基本命令
[Problem solving] QT update component appears "To continue this operation, at least one valid and enabled repository is required"
阴影初始化【5】
杭电校赛(ACM组队安排)
Redis 复习计划 - Redis主从数据一致性和哨兵机制
Problem solving-->Online OJ (18)
[Opportunity Enlightenment-60]: "Soldiers, Stupid Ways"-1- Opening: "Death" and "Life" are the way of heaven
七夕邂逅爱,那人一定在
【HMS core】【Media】【视频编辑服务】 在线素材无法展示,一直Loading状态或是网络异常
数据库恢复
Find My Technology | Prevent your pet from getting lost, Apple Find My technology can help you
如何才能有效、高效阅读?猿辅导建议“因材因时施教”
集合划分差最小问题(01背包)