当前位置:网站首页>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]边栏推荐
猜你喜欢

Basic properties of binary tree + oj problem analysis

类的底层机制

mutillidae download and installation

MySQL Foundation (1) - Basic Cognition and Operation
![[cesium] element highlighting](/img/99/504ca9802db83eb33bc6d91b34fa84.png)
[cesium] element highlighting

Flutter学习2-dart学习

Homework 8.4 Interprocess Communication Pipes and Signals

WPF中DataContext作用

MySQL基础(一)---基础认知及操作

upload upload pictures to Tencent cloud, how to upload pictures
随机推荐
dedecms dream weaving tag tag does not support capital letters fix
2022 Hangzhou Electric Multi-School 1st Session 01
开发一套高容错分布式系统
Transformation 和 Action 常用算子
软件管理rpm
jvm three heap and stack
span标签和p标签的区别
The mall background management system based on Web design and implementation
作业8.4 进程间的通信 管道与信号
入口点注入
upload upload pictures to Tencent cloud, how to upload pictures
How does the Flutter TapGestureRecognizer work
A blog clears the Redis technology stack
Develop a highly fault-tolerant distributed system
【学习笔记之菜Dog学C】动态内存管理之经典笔试题
Day019 Method overriding and introduction of related classes
[Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)
uboot enable debug printing information
LAB Semaphore Implementation Details
Flutter学习5-集成-打包-发布