当前位置:网站首页>LeetCode: 1403. Minimum subsequence in non-increasing order [greedy]
LeetCode: 1403. Minimum subsequence in non-increasing order [greedy]
2022-08-05 05:16:00 【starry sky】
topic description
Things
Sort the nums, starting with the largest number, until those numbers greater than the sum of the total are selected.
AC Code
class Solution:def minSubsequence(self, nums: List[int]) -> List[int]:nums.sort(reverse = True)tot, cur = sum(nums), 0for i in range(len(nums)):cur += nums[i]if cur > tot /2 :return nums[: i+1]
边栏推荐
- Community Sharing|Tencent Overseas Games builds game security operation capabilities based on JumpServer
- 【无标题】
- Flex layout frog game clearance strategy
- 【cesium】元素高亮显示
- University Physics---Particle Kinematics
- jvm 三 之堆与栈
- [Nine Lectures on Backpacks - 01 Backpack Problems]
- Flutter学习4-基本UI组件
- The mall background management system based on Web design and implementation
- Dephi逆向工具Dede导出函数名MAP导入到IDA中
猜你喜欢
span标签和p标签的区别
mutillidae download and installation
ESP32 485 Illuminance
基于Web的商城后台管理系统的设计与实现
MySQL Foundation (1) - Basic Cognition and Operation
Reverse theory knowledge 4
Structured light 3D reconstruction (1) Striped structured light 3D reconstruction
【学习笔记之菜Dog学C】动态内存管理之经典笔试题
In the hot summer, teach you to use Xiaomi smart home accessories + Raspberry Pi 4 to connect to Apple HomeKit
Please write the SparkSQL statement
随机推荐
Wise Force Deleter强制删除工具
类的底层机制
u-boot调试定位手段
uva1325
Qt produces 18 frames of Cupid to express his love, is it your Cupid!!!
Using QR codes to solve fixed asset management challenges
The underlying mechanism of the class
Geek卸载工具
Flutter学习-开篇
phone call function
Application status of digital twin technology in power system
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
【解码工具】Bitcoin的一些在线工具
2022杭电多校第一场01
Understanding and use of C# on set() and get() methods
Please write the SparkSQL statement
Dashboard Display | DataEase Look at China: Data Presents China's Capital Market
Mysql5.7 二进制 部署
Develop a highly fault-tolerant distributed system
span标签和p标签的区别