p
Size: a a a
p
p
А⚙
SS
DS
ID
а
A
А⚙
DS
а
DS
DS
DS
А⚙
А⚙
H
ΑZ
DS
extension [T](xs: List[T])(using Ordering[T])
def smallest(n: Int): List[T] = xs.sorted.take(n)
def smallestIndices(n: Int): List[Int] =
val limit = smallest(n).max
xs.zipWithIndex.collect { case (x, i) if x <= limit => i }
ΑZ