Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Lightbulb Intro by artemx8zx
from datetime import datetime
from typing import List
from functools import reduce
from operator import add
def sum_light(els: List[datetime]) -> int:
groups = [els[i:i+2] for i in range(0, len(els), 2)]
diff_groups = [(d[1]-d[0]).total_seconds() for d in groups]
s = reduce(add, diff_groups)
return s
Oct. 19, 2021
Comments: