/**
 * This exercise requires you to remove any repeating elements from a list.
 *
 * Complete the code below to solve the exercise.
 */
fun removeRepeatingElements(lst: MutableList<Int>): List<Int> {

    // Create a variable to store the indexes of duplicate elements
    val duplicates = mutableListOf<Int>()

    // Iterate over the elements in the list
    for (i in lst.indices) {
        // Check if the current element has already occurred before
        if (lst.subList(0, i).contains(lst[i])) {
            // Add the index of the duplicate element to the duplicates list
            duplicates.add(i)
        }
    }

    // Remove the duplicate elements using their indexes
    duplicates.sortedDescending().forEach {
        lst.removeAt(it)
    }

    return lst
}
/**
 * This exercise requires you to remove any repeating elements from a list.
 *
 * Complete the code below to solve the exercise.
 */
fun removeRepeatingElements(lst: MutableList<Int>): List<Int> {
/**
 * This exercise requires you to remove any repeating elements from a list.
 *
 * Complete the code below to solve the exercise.
 */
fun removeRepeatingElements(lst: MutableList<Int>): List<Int> {

    // Create a variable to store the indexes of duplicate elements
    val duplicates = mutableListOf<Int>()

    // Iterate over the elements in the list
    for (i in lst.indices) {
        // Check if the current element has already occurred before
        if (lst.subList(0, i).contains(lst[i])) {
            // Add the index of the duplicate element to the duplicates list
            duplicates.add(i)
        }
    }

    // Remove the duplicate elements using their indexes
    duplicates.sortedDescending().forEach {
        lst.removeAt(it)
    }

    return lst
}