/**
 * Given two arrays representing coordinates in a 2D plane, return the intersection points between the two arrays.
 *
 * @param array1 A list of pairs representing the x and y coordinates of points in array1
 * @param array2 A list of pairs representing the x and y coordinates of points in array2
 * @return A list of pairs representing the intersection points between array1 and array2
 */
fun findIntersectionPoints(array1: List<Pair<Int, Int>>, array2: List<Pair<Int, Int>>): List<Pair<Int, Int>> {

    // Create a set to store the intersection points
    val intersectionPoints = mutableSetOf<Pair<Int, Int>>()

    // Iterate through all pairs of points in array1 and array2
    for (point1 in array1) {
        for (point2 in array2) {
            // Check if the x and y coordinates match
            if (point1.first == point2.first && point1.second == point2.second) {
                // If yes, add the point to the intersection set
                intersectionPoints.add(point1)
            }
        }
    }

    // Return the list of intersection points
    return intersectionPoints.toList()
}
/**
 * Given two arrays representing coordinates in a 2D plane, return the intersection points between the two arrays.
 *
 * @param array1 A list of pairs representing the x and y coordinates of points in array1
 * @param array2 A list of pairs representing the x and y coordinates of points in array2
 * @return A list of pairs representing the intersection points between array1 and array2
 */
fun findIntersectionPoints(array1: List<Pair<Int, Int>>, array2: List<Pair<Int, Int>>): List<Pair<Int, Int>> {
/**
 * Given two arrays representing coordinates in a 2D plane, return the intersection points between the two arrays.
 *
 * @param array1 A list of pairs representing the x and y coordinates of points in array1
 * @param array2 A list of pairs representing the x and y coordinates of points in array2
 * @return A list of pairs representing the intersection points between array1 and array2
 */
fun findIntersectionPoints(array1: List<Pair<Int, Int>>, array2: List<Pair<Int, Int>>): List<Pair<Int, Int>> {

    // Create a set to store the intersection points
    val intersectionPoints = mutableSetOf<Pair<Int, Int>>()

    // Iterate through all pairs of points in array1 and array2
    for (point1 in array1) {
        for (point2 in array2) {
            // Check if the x and y coordinates match
            if (point1.first == point2.first && point1.second == point2.second) {
                // If yes, add the point to the intersection set
                intersectionPoints.add(point1)
            }
        }
    }

    // Return the list of intersection points
    return intersectionPoints.toList()
}