- LeetCode_1403. Minimum Subsequen
- 2. DP_最长公共子序列
- 1143. Longest Common Subsequence
- Numbers of palindromic subsequen
- 111 Minimum Depth of Binary Tree
- Q111 Minimum Depth of Binary Tre
- 111. Minimum Depth of Binary Tre
- Leetcode 111. Minimum Depth of B
- 111. Minimum Depth of Binary Tre
- 111. Minimum Depth of Binary Tre
思路:先把列表排序,从大到小,然后,前i个元素之和大于总和的二分之一,输出前i个元素
要点:循环要从1开始
x=sorted(nums,reverse=True)
for i in range(1,len(x)+1):
if sum(x[:i])>(sum(x)/2):
return x[:i]
网友评论