/**
 * This function removes all occurrences of the target element from the given list using the
 * NOT operator and looping through the list.
 *
 * @param lst A list of elements.
 * @param target The target element to be removed from the list.
 * @return The filtered list with all occurrences of the target element removed.
 *
 * Example:
 * filterOutList(listOf(1, 2, 3, 4, 5, 4, 3, 2, 1), 4) returns [1, 2, 3, 5, 3, 2, 1]
 */
fun filterOutList(lst: MutableList<Int>, target: Int): List<Int> {

    var i = 0
    while (i < lst.size) {
        if (lst[i] != target) {
            i++
        } else {
            lst.removeAt(i)
        }
    }
    return lst
}
/**
 * This function removes all occurrences of the target element from the given list using the
 * NOT operator and looping through the list.
 *
 * @param lst A list of elements.
 * @param target The target element to be removed from the list.
 * @return The filtered list with all occurrences of the target element removed.
 *
 * Example:
 * filterOutList(listOf(1, 2, 3, 4, 5, 4, 3, 2, 1), 4) returns [1, 2, 3, 5, 3, 2, 1]
 */
fun filterOutList(lst: MutableList<Int>, target: Int): List<Int> {
/**
 * This function removes all occurrences of the target element from the given list using the
 * NOT operator and looping through the list.
 *
 * @param lst A list of elements.
 * @param target The target element to be removed from the list.
 * @return The filtered list with all occurrences of the target element removed.
 *
 * Example:
 * filterOutList(listOf(1, 2, 3, 4, 5, 4, 3, 2, 1), 4) returns [1, 2, 3, 5, 3, 2, 1]
 */
fun filterOutList(lst: MutableList<Int>, target: Int): List<Int> {

    var i = 0
    while (i < lst.size) {
        if (lst[i] != target) {
            i++
        } else {
            lst.removeAt(i)
        }
    }
    return lst
}