Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
heapq: nlargest, nsmallest solution in Clear category for Shorter Set by Phil15
from heapq import nlargest, nsmallest
def remove_min_max(data: set, total:int) -> set:
return data - set(nlargest(total, data) + nsmallest(total, data))
Nov. 4, 2021