/**
 * Given a set of elements, add a series of elements to the set and find the element at a specific index.
 *
 * @param setElements A set of elements.
 * @param indexToFind The index of the element to be found.
 * @return The element at the specified index.
 *
 * Exercise:
 * Add the elements 10, 15, 20, 25, 30 to the given set. Then, find the element at the index 'indexToFind'.
 * If the provided index is out of bounds, return -1.
 */
fun addElementsAndIndexSet(setElements: MutableSet<Int>, indexToFind: Int): Int {

    // Add elements to the set
    setElements.add(10)
    setElements.add(15)
    setElements.add(20)
    setElements.add(25)
    setElements.add(30)

    return try {
        setElements.sorted()[indexToFind]
    } catch (e: IndexOutOfBoundsException) {
        -1
    }
}
/**
 * Given a set of elements, add a series of elements to the set and find the element at a specific index.
 *
 * @param setElements A set of elements.
 * @param indexToFind The index of the element to be found.
 * @return The element at the specified index.
 *
 * Exercise:
 * Add the elements 10, 15, 20, 25, 30 to the given set. Then, find the element at the index 'indexToFind'.
 * If the provided index is out of bounds, return -1.
 */
fun addElementsAndIndexSet(setElements: MutableSet<Int>, indexToFind: Int): Int {
/**
 * Given a set of elements, add a series of elements to the set and find the element at a specific index.
 *
 * @param setElements A set of elements.
 * @param indexToFind The index of the element to be found.
 * @return The element at the specified index.
 *
 * Exercise:
 * Add the elements 10, 15, 20, 25, 30 to the given set. Then, find the element at the index 'indexToFind'.
 * If the provided index is out of bounds, return -1.
 */
fun addElementsAndIndexSet(setElements: MutableSet<Int>, indexToFind: Int): Int {

    // Add elements to the set
    setElements.add(10)
    setElements.add(15)
    setElements.add(20)
    setElements.add(25)
    setElements.add(30)

    return try {
        setElements.sorted()[indexToFind]
    } catch (e: IndexOutOfBoundsException) {
        -1
    }
}