티스토리

snoopybox
검색하기

[LeetCode][Python3] 406. Queue Reconstruction by Height

프로그래밍/LeetCode

[LeetCode][Python3] 406. Queue Reconstruction by Height

snoopybox 2019. 9. 23. 23:43

Problem :

https://leetcode.com/problems/queue-reconstruction-by-height/


My Solution :

class Solution:
    def reconstructQueue(self, people):
        people.sort(key=lambda x: (-x[0], x[1]))
        ans = []
        for h, k in people:
            ans.insert(k, (h, k))
        return ans
저작자표시

블로그 정보

snoopybox

컴퓨터, 윈도우, 리눅스, 프로그래밍, 알고리즘, 파이썬, 프로그램, 동영상

프로필 사진
문의안내
  • 티스토리
  • 로그인
  • 고객센터

티스토리는 카카오에서 사랑을 담아 만듭니다.

© Kakao Corp.