/**
 * Given a list of numbers 'numList' and a list of indices to remove 'removeIdx',
 * this function should append a number to numList and remove the numbers at the specified indices.
 * The function should return the modified numList.
 *
 * Example:
 * Input:
 * numList = [1, 2, 3, 4, 5]
 * removeIdx = [0, 2, 4]
 * Output:
 * [2, 4]
 *
 * @param numList A list of numbers.
 * @param removeIdx A list of indices to remove.
 * @return The modified numList.
 */
fun appendAndRemove(numList: MutableList<Int>, removeIdx: List<Int>): List<Int> {

    // Append a number to numList
    numList.add(6)

    // Remove numbers at the specified indices
    for (idx in removeIdx.sortedDescending()) {
        numList.removeAt(idx)
    }

    return numList
}
/**
 * Given a list of numbers 'numList' and a list of indices to remove 'removeIdx',
 * this function should append a number to numList and remove the numbers at the specified indices.
 * The function should return the modified numList.
 *
 * Example:
 * Input:
 * numList = [1, 2, 3, 4, 5]
 * removeIdx = [0, 2, 4]
 * Output:
 * [2, 4]
 *
 * @param numList A list of numbers.
 * @param removeIdx A list of indices to remove.
 * @return The modified numList.
 */
fun appendAndRemove(numList: MutableList<Int>, removeIdx: List<Int>): List<Int> {
/**
 * Given a list of numbers 'numList' and a list of indices to remove 'removeIdx',
 * this function should append a number to numList and remove the numbers at the specified indices.
 * The function should return the modified numList.
 *
 * Example:
 * Input:
 * numList = [1, 2, 3, 4, 5]
 * removeIdx = [0, 2, 4]
 * Output:
 * [2, 4]
 *
 * @param numList A list of numbers.
 * @param removeIdx A list of indices to remove.
 * @return The modified numList.
 */
fun appendAndRemove(numList: MutableList<Int>, removeIdx: List<Int>): List<Int> {

    // Append a number to numList
    numList.add(6)

    // Remove numbers at the specified indices
    for (idx in removeIdx.sortedDescending()) {
        numList.removeAt(idx)
    }

    return numList
}