Python | Leetcode Python题解之第406题根据身高重建队列

题目:

题解:

python 复制代码
class Solution:
    def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
        people.sort(key=lambda x: (-x[0], x[1]))
        n = len(people)
        ans = list()
        for person in people:
            ans[person[1]:person[1]] = [person]
        return ans
相关推荐
0_0梅伊阁诗人21 小时前
Flask
开发语言·数据库·python·flask
HAH-HAH1 天前
【Python 入门】(2)Python 语言基础(变量)
开发语言·python·学习·青少年编程·个人开发·变量·python 语法
SunnyDays10111 天前
Python 轻松实现替换或修改 PDF 文字
python·替换pdf文字·修改pdf·修改pdf文字
Just_Paranoid1 天前
【Settings】恢复出厂设置密码校验
android·python·settings·sha256·hmac-sha256
西猫雷婶1 天前
pytorch基本运算-Python控制流梯度运算
人工智能·pytorch·python·深度学习·神经网络·机器学习
子午1 天前
Python的uv包管理工具使用
开发语言·python·uv
java1234_小锋1 天前
Scikit-learn Python机器学习 - 分类算法 - 朴素贝叶斯
python·机器学习·scikit-learn
凡梦千华1 天前
Django时区感知
后端·python·django
hn小菜鸡1 天前
LeetCode 3643.垂直翻转子矩阵
算法·leetcode·矩阵
程序猿 小项目大搞头1 天前
即梦批量生成图片软件使用运营大管家-即梦图片批量生成器
python