Conversation
# Conflicts: # .idea/workspace.xml
…is/algorithms into LEETCODE-insert-interval
intervals.md
Outdated
|
|
||
| intervals.append(newInterval) | ||
| out = [] | ||
| for i in sorted(intervals, key=lambda x: x[0]): |
There was a problem hiding this comment.
Мне не ясно, что за переменная i, переименуй, чтобы сразу было понятно
There was a problem hiding this comment.
Мне не ясно, что за переменная i, переименуй, чтобы сразу было понятно
i - элемент списка sorted(intervals, key=lambda x: x[0]) и ничего более.
There was a problem hiding this comment.
Нужен понятный код, а не объяснения
intervals.md
Outdated
| """ | ||
|
|
||
| out = [] | ||
| for i in sorted(intervals, key=lambda x: x[0]): |
There was a problem hiding this comment.
Здесь пробегаем по отсортированному по x[0] переменной списку
There was a problem hiding this comment.
Нужен понятный код, а не объяснения
intervals.md
Outdated
| :rtype: List[List[int]] | ||
| """ | ||
|
|
||
| out = [] |
There was a problem hiding this comment.
И это
Это уже :rtype: List[List[int]]
There was a problem hiding this comment.
Нужен понятный код, а не объяснения
intervals.md
Outdated
| """ | ||
|
|
||
| intervals = sorted(intervals, key=lambda x: x[0]) | ||
| out = 0 |
|
@Vivelapaix прошу ещё раз посмотреть PR |
| https://leetcode.com/problems/merge-intervals/ | ||
|
|
||
| ```python | ||
| class Solution(object): |
| https://leetcode.com/problems/insert-interval/ | ||
|
|
||
| ```python | ||
| class Solution(object): |
intervals.md
Outdated
| :rtype: int | ||
| """ | ||
|
|
||
| intervals = sorted(intervals, key=lambda x: x[0]) |
There was a problem hiding this comment.
Попробуй здесь отсортировать по правой границе и посчитать количество неперекрывающихся интервалов, тогда и код станет короче
There was a problem hiding this comment.
Понимаю, но эти бранчи были сделаны ещё до того, как было объявлено, что 1 задача - 1 PR. Следующие пойдут по правилам.
No description provided.