当前位置:网站首页>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]
边栏推荐
- Flutter learning - the beginning
- In the hot summer, teach you to use Xiaomi smart home accessories + Raspberry Pi 4 to connect to Apple HomeKit
- Qt制作18帧丘比特表白意中人、是你的丘比特嘛!!!
- Excel Paint
- 2022杭电多校第一场01
- MySQL中控制导出文件后变为了\N有什么解决方案吗?
- Difference between for..in and for..of
- u-boot调试定位手段
- 【cesium】3D Tileset 模型加载并与模型树关联
- "PHP8 Beginner's Guide" A brief introduction to PHP
猜你喜欢
In the hot summer, teach you to use Xiaomi smart home accessories + Raspberry Pi 4 to connect to Apple HomeKit
2022 Hangzhou Electric Multi-School 1st Session 01
【cesium】加载并定位 3D Tileset
Basic properties of binary tree + oj problem analysis
mutillidae download and installation
ESP32 485光照度
u-boot调试定位手段
u-boot debugging and positioning means
[cesium] 3D Tileset model is loaded and associated with the model tree
[Surveying] Quick Summary - Excerpt from Gaoshu Gang
随机推荐
RL强化学习总结(一)
ESP32 485光照度
入口点注入
Structured light 3D reconstruction (1) Striped structured light 3D reconstruction
Multi-threaded query results, add List collection
Dashboard Display | DataEase Look at China: Data Presents China's Capital Market
Returned object not currently part of this pool
Excel画图
Flex layout frog game clearance strategy
redis复制机制
多线程查询结果,添加List集合
Requests the library deployment and common function
UVA10827
"PHP8 Beginner's Guide" A brief introduction to PHP
MySQL Foundation (1) - Basic Cognition and Operation
Error creating bean with name ‘configDataContextRefresher‘ defined in class path resource
【转】什么是etcd
After controlling the export file in MySQL, it becomes \N. Is there any solution?
2023 International Conference on Information and Communication Engineering (JCICE 2023)
phone call function