/**
 * Given a list 'lst' containing boolean values and an 'index',
 * modify the list such that the boolean value at the given index 
 * is changed to the opposite value (True to False or False to True).
 *
 * @param lst A list containing boolean values.
 * @param index The index of the element to be modified.
 * @return The modified list after changing the boolean value at the given index.
 *
 * Example:
 * changeBooleanElement(listOf(true, true, false, false, true), 2)
 * Output: [true, true, true, false, true]
 */
fun changeBooleanElement(lst: MutableList<Boolean>, index: Int): List<Boolean> {

    // Check if index is valid
    if (index >= 0 && index < lst.size) {
        // Change boolean element at given index to its opposite value
        lst[index] = !lst[index]
    }
    
    return lst
}
/**
 * Given a list 'lst' containing boolean values and an 'index',
 * modify the list such that the boolean value at the given index 
 * is changed to the opposite value (True to False or False to True).
 *
 * @param lst A list containing boolean values.
 * @param index The index of the element to be modified.
 * @return The modified list after changing the boolean value at the given index.
 *
 * Example:
 * changeBooleanElement(listOf(true, true, false, false, true), 2)
 * Output: [true, true, true, false, true]
 */
fun changeBooleanElement(lst: MutableList<Boolean>, index: Int): List<Boolean> {
/**
 * Given a list 'lst' containing boolean values and an 'index',
 * modify the list such that the boolean value at the given index 
 * is changed to the opposite value (True to False or False to True).
 *
 * @param lst A list containing boolean values.
 * @param index The index of the element to be modified.
 * @return The modified list after changing the boolean value at the given index.
 *
 * Example:
 * changeBooleanElement(listOf(true, true, false, false, true), 2)
 * Output: [true, true, true, false, true]
 */
fun changeBooleanElement(lst: MutableList<Boolean>, index: Int): List<Boolean> {

    // Check if index is valid
    if (index >= 0 && index < lst.size) {
        // Change boolean element at given index to its opposite value
        lst[index] = !lst[index]
    }
    
    return lst
}