/**
 * This exercise requires finding the common elements between two lists and comparing tuples.
 *
 * Given two lists, list1 and list2, the task is to find the common elements between them and return a list of tuples.
 * Each tuple should contain the common element and their respective index positions in list1 and list2.
 *
 * For example, if list1 = [3, 2, 5, 1, 4] and list2 = [1, 2, 6, 4, 3], the common elements are [2, 3, 4, 1].
 * The output of the function should be [(2, 1, 1), (3, 4, 5), (4, 5, 4), (1, 3, 0)].
 *
 * Your task is to complete the missing parts of the code to achieve the desired output.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Triple<Int, Int, Int>> {

    val commonElements = mutableListOf<Triple<Int, Int, Int>>()
    for (i in list1.indices) {
        for (j in list2.indices) {
            if (list1[i] == list2[j]) {
                commonElements.add(Triple(list1[i], i, j))
            }
        }
    }
    return commonElements
}
/**
 * This exercise requires finding the common elements between two lists and comparing tuples.
 *
 * Given two lists, list1 and list2, the task is to find the common elements between them and return a list of tuples.
 * Each tuple should contain the common element and their respective index positions in list1 and list2.
 *
 * For example, if list1 = [3, 2, 5, 1, 4] and list2 = [1, 2, 6, 4, 3], the common elements are [2, 3, 4, 1].
 * The output of the function should be [(2, 1, 1), (3, 4, 5), (4, 5, 4), (1, 3, 0)].
 *
 * Your task is to complete the missing parts of the code to achieve the desired output.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Triple<Int, Int, Int>> {
/**
 * This exercise requires finding the common elements between two lists and comparing tuples.
 *
 * Given two lists, list1 and list2, the task is to find the common elements between them and return a list of tuples.
 * Each tuple should contain the common element and their respective index positions in list1 and list2.
 *
 * For example, if list1 = [3, 2, 5, 1, 4] and list2 = [1, 2, 6, 4, 3], the common elements are [2, 3, 4, 1].
 * The output of the function should be [(2, 1, 1), (3, 4, 5), (4, 5, 4), (1, 3, 0)].
 *
 * Your task is to complete the missing parts of the code to achieve the desired output.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Triple<Int, Int, Int>> {

    val commonElements = mutableListOf<Triple<Int, Int, Int>>()
    for (i in list1.indices) {
        for (j in list2.indices) {
            if (list1[i] == list2[j]) {
                commonElements.add(Triple(list1[i], i, j))
            }
        }
    }
    return commonElements
}