Turn sort into a simple lambda
sort_values = lambda x: sorted(x)
from __future__ import annotationsfrom collections import Counterdef sort_values(vals:list[int]) -> list[int]:#Given an array of size N containing only 0s, 1s, and 2s;#sort the array in ascending order.assert set(vals) <= {0,1,2}return counting_sort(vals)# O(n+k) instead of n log(n)def counting_sort(vals:list[T]) -> list[T]:res = []c = Counter(vals)for k,amt in sorted(c.items()):res += [k]*amtreturn res- sort_values = lambda x: sorted(x)