/**
 * This exercise aims to find the intersection between values and indices of a list using the enumerate and while loop.
 *
 * @param numIterations Specifies the maximum number of iterations allowed.
 * @param listOfValues A list of numeric values.
 * @return A dictionary containing the intersected indices and values from the list.
 */
fun intersectionGeologist(numIterations: Int, listOfValues: List<Int>): Map<Int, Int> {

    val intersection = mutableMapOf<Int, Int>()  // Initialize an empty dictionary
    var i = 0  // Initialize a counter

    while (i < listOfValues.size && i < numIterations) {
        for ((index, value) in listOfValues.withIndex()) {
            if (index == value) {
                intersection[index] = value
                break
            }
        }
        i++
    }

    return intersection
}
/**
 * This exercise aims to find the intersection between values and indices of a list using the enumerate and while loop.
 *
 * @param numIterations Specifies the maximum number of iterations allowed.
 * @param listOfValues A list of numeric values.
 * @return A dictionary containing the intersected indices and values from the list.
 */
fun intersectionGeologist(numIterations: Int, listOfValues: List<Int>): Map<Int, Int> {
/**
 * This exercise aims to find the intersection between values and indices of a list using the enumerate and while loop.
 *
 * @param numIterations Specifies the maximum number of iterations allowed.
 * @param listOfValues A list of numeric values.
 * @return A dictionary containing the intersected indices and values from the list.
 */
fun intersectionGeologist(numIterations: Int, listOfValues: List<Int>): Map<Int, Int> {

    val intersection = mutableMapOf<Int, Int>()  // Initialize an empty dictionary
    var i = 0  // Initialize a counter

    while (i < listOfValues.size && i < numIterations) {
        for ((index, value) in listOfValues.withIndex()) {
            if (index == value) {
                intersection[index] = value
                break
            }
        }
        i++
    }

    return intersection
}