Skip to content

Leetcode sort list#24

Open
Igneaalis wants to merge 15 commits intomasterfrom
LEETCODE-sort-list
Open

Leetcode sort list#24
Igneaalis wants to merge 15 commits intomasterfrom
LEETCODE-sort-list

Conversation

@Igneaalis
Copy link
Copy Markdown
Owner

Added LEETCODE "sort-list" recursive solution.

@Igneaalis Igneaalis requested a review from Vivelapaix June 4, 2020 22:12
linked-list.md Outdated
:type headA, headB: ListNode
:rtype: ListNode
"""
if headA and headB:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Итеративный merge надо

# self.val = val
# self.next = next
class Solution(object):
def sortList(self, _head):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ты не напишешь это решение сходу.

Напиши обычное:

  1. Разбил пополам списки
  2. Сделал рекурсивный вызов от двух половин
  3. Сделал merge

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделал.

@Igneaalis Igneaalis added the review Review requested label Jun 5, 2020
@Igneaalis Igneaalis requested a review from Vivelapaix June 5, 2020 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review Review requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants