728x90
반응형
[Leetcode] 리트코드 - 삽입 정렬 리스트(insertion-sort-list) 파이썬(python) 풀이
문제 연결 리스트를 삽입정렬로 정렬하라. 코드 class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def insertionSortList(self, head: ListNode) -> ListNode: cur = parent = ListNode(0) while head: while cur.next and cur.next.val head.val: cur = parent return parent.ne..
Leetcode
2021. 1. 26. 08:00
728x90
반응형