/**
 * Given a set 's' and a range of positions 'start' and 'end', this function removes the elements
 * in the set that fall within the specified range.
 *
 * @param s The set from which elements are to be removed.
 * @param start The starting position of the range.
 * @param end The ending position of the range.
 * @return The set with elements removed within the specified range.
 */
fun removeElementsFromSet(s: MutableSet<Int>, start: Int, end: Int): MutableSet<Int> {

    if (start > end) {
        return s
    }

    // Create a list of elements in the set
    val elements = s.toList()

    // Iterate over the elements in reverse order to avoid index shifting
    for (i in elements.size - 1 downTo 0) {
        if (i in start..end) {
            s.remove(elements[i])
        }
    }

    return s
}
/**
 * Given a set 's' and a range of positions 'start' and 'end', this function removes the elements
 * in the set that fall within the specified range.
 *
 * @param s The set from which elements are to be removed.
 * @param start The starting position of the range.
 * @param end The ending position of the range.
 * @return The set with elements removed within the specified range.
 */
fun removeElementsFromSet(s: MutableSet<Int>, start: Int, end: Int): MutableSet<Int> {
/**
 * Given a set 's' and a range of positions 'start' and 'end', this function removes the elements
 * in the set that fall within the specified range.
 *
 * @param s The set from which elements are to be removed.
 * @param start The starting position of the range.
 * @param end The ending position of the range.
 * @return The set with elements removed within the specified range.
 */
fun removeElementsFromSet(s: MutableSet<Int>, start: Int, end: Int): MutableSet<Int> {

    if (start > end) {
        return s
    }

    // Create a list of elements in the set
    val elements = s.toList()

    // Iterate over the elements in reverse order to avoid index shifting
    for (i in elements.size - 1 downTo 0) {
        if (i in start..end) {
            s.remove(elements[i])
        }
    }

    return s
}