Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
slice into start and end arrays, then compute and sum up the timedeltas solution in Speedy category for Lightbulb Intro by leggewie
from datetime import datetime
from typing import List
def sum_light(els: List[datetime]) -> int:
"""
how long the light bulb has been turned on
"""
return sum(list(map(lambda start, end: int((start - end).total_seconds()), els[1::2], els[0::2])))
May 29, 2021
Comments: