Skip to content

Leetcode insert interval#3

Open
Igneaalis wants to merge 15 commits intomasterfrom
LEETCODE-insert-interval
Open

Leetcode insert interval#3
Igneaalis wants to merge 15 commits intomasterfrom
LEETCODE-insert-interval

Conversation

@Igneaalis
Copy link
Copy Markdown
Owner

No description provided.

@Igneaalis Igneaalis requested a review from Vivelapaix May 13, 2020 11:33
intervals.md Outdated

intervals.append(newInterval)
out = []
for i in sorted(intervals, key=lambda x: x[0]):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Мне не ясно, что за переменная i, переименуй, чтобы сразу было понятно

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.

Мне не ясно, что за переменная i, переименуй, чтобы сразу было понятно

i - элемент списка sorted(intervals, key=lambda x: x[0]) и ничего более.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужен понятный код, а не объяснения

intervals.md Outdated
"""

out = []
for i in sorted(intervals, key=lambda x: x[0]):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

И здесь

Copy link
Copy Markdown
Owner Author

@Igneaalis Igneaalis May 17, 2020

Choose a reason for hiding this comment

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

Здесь пробегаем по отсортированному по x[0] переменной списку

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужен понятный код, а не объяснения

intervals.md Outdated
:rtype: List[List[int]]
"""

out = []
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

И это

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.

И это

Это уже :rtype: List[List[int]]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нужен понятный код, а не объяснения

intervals.md Outdated
"""

intervals = sorted(intervals, key=lambda x: x[0])
out = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Что out ?

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.

Что out ?

:rtype: int

@Igneaalis
Copy link
Copy Markdown
Owner Author

@Vivelapaix прошу ещё раз посмотреть PR

https://leetcode.com/problems/merge-intervals/

```python
class Solution(object):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Здесь все хорошо

https://leetcode.com/problems/insert-interval/

```python
class Solution(object):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Здесь все хорошо

intervals.md Outdated
:rtype: int
"""

intervals = sorted(intervals, key=lambda x: x[0])
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Попробуй здесь отсортировать по правой границе и посчитать количество неперекрывающихся интервалов, тогда и код станет короче

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 задача - 1 PR

Так бы уже 2 залил

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.

Понимаю, но эти бранчи были сделаны ещё до того, как было объявлено, что 1 задача - 1 PR. Следующие пойдут по правилам.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants