Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
x, y, z in zip( els, els[1: ], els[2: ] ) solution in Clear category for Median of Three by vnkvstnk
from typing import Iterable
def median_three(els: Iterable[int]) -> Iterable[int]:
answer = els[:2]
for x, y, z in zip(els, els[1:], els[2:]):
answer.append(sorted([x, y, z])[1])
return answer
April 18, 2020
Comments: