/**
 * Given a list of geological layers, find the intersection of two layers.
 *
 * @param a The first geological layer.
 * @param b The second geological layer.
 * @return The intersection of the two layers.
 *
 * Example:
 * findIntersection(listOf(1, 2, 3, 4, 5), listOf(3, 4, 5, 6, 7)) // [3, 4, 5]
 * findIntersection(listOf(1, 2, 3), listOf(4, 5, 6)) // []
 */
fun findIntersection(a: List<Int>, b: List<Int>): List<Int> {

    // Check if the input layers are not empty
    if (a.isEmpty() || b.isEmpty()) {
        return emptyList()
    }

    // Find the intersection using filter function
    val intersection = a.filter { it in b }

    return intersection
}
/**
 * Given a list of geological layers, find the intersection of two layers.
 *
 * @param a The first geological layer.
 * @param b The second geological layer.
 * @return The intersection of the two layers.
 *
 * Example:
 * findIntersection(listOf(1, 2, 3, 4, 5), listOf(3, 4, 5, 6, 7)) // [3, 4, 5]
 * findIntersection(listOf(1, 2, 3), listOf(4, 5, 6)) // []
 */
fun findIntersection(a: List<Int>, b: List<Int>): List<Int> {
/**
 * Given a list of geological layers, find the intersection of two layers.
 *
 * @param a The first geological layer.
 * @param b The second geological layer.
 * @return The intersection of the two layers.
 *
 * Example:
 * findIntersection(listOf(1, 2, 3, 4, 5), listOf(3, 4, 5, 6, 7)) // [3, 4, 5]
 * findIntersection(listOf(1, 2, 3), listOf(4, 5, 6)) // []
 */
fun findIntersection(a: List<Int>, b: List<Int>): List<Int> {

    // Check if the input layers are not empty
    if (a.isEmpty() || b.isEmpty()) {
        return emptyList()
    }

    // Find the intersection using filter function
    val intersection = a.filter { it in b }

    return intersection
}