/**
 * This function takes a list of numbers and a target number as input and returns a list containing all the
 * numbers from the input list that are divisible by the target number or whose last digit is equal to the
 * last digit of the target number.
 *
 * @param numbers A list of numbers.
 * @param target The target number to compare each element in the list with.
 * @return A list containing numbers that satisfy the given condition.
 */
fun searchIntersection(numbers: List<Int>, target: Int): List<Int> {

    val result = mutableListOf<Int>()
    var i = 0
    while (i < numbers.size) {
        if (numbers[i] % target == 0 || numbers[i] % 10 == target % 10) {
            result.add(numbers[i])
        }
        i++
    }
    return result
}
/**
 * This function takes a list of numbers and a target number as input and returns a list containing all the
 * numbers from the input list that are divisible by the target number or whose last digit is equal to the
 * last digit of the target number.
 *
 * @param numbers A list of numbers.
 * @param target The target number to compare each element in the list with.
 * @return A list containing numbers that satisfy the given condition.
 */
fun searchIntersection(numbers: List<Int>, target: Int): List<Int> {
/**
 * This function takes a list of numbers and a target number as input and returns a list containing all the
 * numbers from the input list that are divisible by the target number or whose last digit is equal to the
 * last digit of the target number.
 *
 * @param numbers A list of numbers.
 * @param target The target number to compare each element in the list with.
 * @return A list containing numbers that satisfy the given condition.
 */
fun searchIntersection(numbers: List<Int>, target: Int): List<Int> {

    val result = mutableListOf<Int>()
    var i = 0
    while (i < numbers.size) {
        if (numbers[i] % target == 0 || numbers[i] % 10 == target % 10) {
            result.add(numbers[i])
        }
        i++
    }
    return result
}