当前位置:网站首页>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]边栏推荐
- Detailed Explanation of Redis Sentinel Mode Configuration File
- [Decoding tools] Some online tools for Bitcoin
- 1.3 mysql batch insert data
- phone call function
- Excel画图
- coppercam primer [6]
- Error creating bean with name 'configDataContextRefresher' defined in class path resource
- Multi-threaded query results, add List collection
- Detailed explanation of each module of ansible
- 二叉树基本性质+oj题解析
猜你喜欢

【学生毕业设计】基于web学生信息管理系统网站的设计与实现(13个页面)

Wise Force Deleter强制删除工具
![[Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)](/img/86/9c9a2541f2b7089ae47e9832fffdb3.png)
[Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)

一篇博客通关Redis技术栈

Difference between for..in and for..of

Detailed Explanation of Redis Sentinel Mode Configuration File

Flutter real machine running and simulator running

RL reinforcement learning summary (1)

Develop a highly fault-tolerant distributed system

University Physics---Particle Kinematics
随机推荐
shell函数
Structured Light 3D Reconstruction (2) Line Structured Light 3D Reconstruction
ESP32 485 Illuminance
Excel Paint
一篇博客通关Redis技术栈
upload upload pictures to Tencent cloud, how to upload pictures
重新审视分布式系统:永远不会有完美的一致性方案……
mysql数据库表什么字段类型的存储长度最大?
类的底层机制
jvm 三 之堆与栈
Returned object not currently part of this pool
number_gets the specified number of decimals
UVA10827
Shell(4) Conditional Control Statement
coppercam primer [6]
uva1325
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
1068找到更多的硬币
MySQL基础(一)---基础认知及操作
dedecms error The each() function is deprecated