def selection_sort(arr):
    """Refresher implementation of selection sort - in-place & stable.

    :param arr: List of integers to sort
    :return: Sorted list
    """
    for i in range(len(arr)):
        min = i
        # selecting index of smallest number
        for j in range(i, len(arr)):
            if arr[j] < arr[min]:
                min = j
        # swaping current index with smallest number
        arr[i], arr[min] = arr[min], arr[i]
    return arr