def _solve_method_3(arr):
    """
    https://github.com/JaredLGillespie/HackerRank/blob/master/Python/minimum-swaps-2.py

    Couldn't really figure it out via my method, but I found this solution that
    was very small and I understand.

    One thing I did was factor out a portion of it into a function call, for
    easier understanding.  A lot of times, of course, in programming, one can
    pack a lot of information in one line of code, but it's good to factor that
    out sometimes.
    """

    def _swap_2_elements(arr, first_index, second_index):
        """
        Swaps 2 positions of the array.

        This function is different from my `update_entries` function above,
        only in that my function operates on an augmented array, rather than
        a bare array.
        """
        temp = arr[first_index]
        arr[first_index] = arr[second_index]
        arr[second_index] = temp
        return arr

    N = len(arr)
    swaps = 0
    for i in range(0, N - 1):
        while arr[i] != i + 1:
            first_index = arr[i] - 1
            second_index = i
            arr = _swap_2_elements(arr, first_index, second_index)
            swaps += 1

    return swaps