Returns the n minimum elements from the provided list.
If n is greater than or equal to the provided list’s length, then return the original list (sorted in ascending order).

Use sorted() to sort the list,[:n]to get the specified number of elements. Omit the second argument,n`, to get a one-element list.

继续阅读 30秒学会 Python 片段 – min_n

Returns the highest index at which value should be inserted into array in order to maintain its sort order, based on a provided iterator function.

Check if the array is sorted in descending order (loosely).
Use to apply the iterator function to all elements of the array.
Use Array.prototype.reverse() and Array.prototype.findIndex() to find the appropriate last index where the element should be inserted, based on the provided iterator function.

继续阅读 30秒学会 JavaScript 片段 – sortedLastIndexBy

Returns the symmetric difference between two lists, after applying the provided function to each list element of both.

Use Iterable.toSet() and to get the unique values in each list after applying fn to them.
Use Iterable.where() in combination with Iterable.contains() to keep only the values in one list and not the other.
Finally, use Iterable.toList() and Iterable.addAll() in combination with the cascade operator (..) to return the result.

继续阅读 30秒学会 Dart 片段 – symmetricDifferenceBy