The task description suggests to use partitions but it is wasteful because this should work too:
// Return customers who have more undelivered orders than delivered
fun Shop.getCustomersWithMoreUndeliveredOrders(): Set<Customer> =
customers.filter {
it.orders.count { it.isDelivered } < it.orders.size / 2
}.toSet()
But it is not accepted:
java.lang.AssertionError: The function 'getCustomersWithMoreUndeliveredOrders' is implemented incorrectly