Python - Sum of Intervals | Codewars 4KYU

preview_player
Показать описание
4KYU Codewars Problem
Рекомендации по теме
Комментарии
Автор

A very nice and short solution! Good job.

yevhenliubarskyi
Автор

I'm testing this kata, but now this kata has large tests and my code can't complete it because it takes more than 12 seconds. And I check your code in this kata, and it doesn't work either.
P.S. My code:
return len(set({i for a, b in intervals for i in range(a, b)}))

pshiro
Автор

Hey bro! It won't pass the execution time (12000 ms) for large numbers. Something like [(0, 20), 10), (30, 40)]

АлексейНикитин-щл
Автор

It don`t work for long intervals like this
[(0, 25), 15), (52, 62)] # result is
.... out of memory ((

Vityk.W
Автор

I made similar code but im trying to think of a better algorithm, its just too slow lol

lepuzki