/**
 * Given two lists, find and return a new list containing the common elements between them.
 *
 * @param listA List of elements.
 * @param listB List of elements.
 * @return List of common elements between listA and listB.
 *
 * Example:
 * val listA = listOf(1, 2, 3, 4, 5, 6)
 * val listB = listOf(3, 4, 5, 6, 7, 8)
 * findCommonElements(listA, listB) // [3, 4, 5, 6]
 *
 * val listA = listOf(10, 20, 30)
 * val listB = listOf(40, 50, 60)
 * findCommonElements(listA, listB) // []
 */
fun findCommonElements(listA: List<Int>, listB: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (element in listA) {
        if (element in listB) {
            commonElements.add(element)
        }
    }
    return commonElements
}
/**
 * Given two lists, find and return a new list containing the common elements between them.
 *
 * @param listA List of elements.
 * @param listB List of elements.
 * @return List of common elements between listA and listB.
 *
 * Example:
 * val listA = listOf(1, 2, 3, 4, 5, 6)
 * val listB = listOf(3, 4, 5, 6, 7, 8)
 * findCommonElements(listA, listB) // [3, 4, 5, 6]
 *
 * val listA = listOf(10, 20, 30)
 * val listB = listOf(40, 50, 60)
 * findCommonElements(listA, listB) // []
 */
fun findCommonElements(listA: List<Int>, listB: List<Int>): List<Int> {
/**
 * Given two lists, find and return a new list containing the common elements between them.
 *
 * @param listA List of elements.
 * @param listB List of elements.
 * @return List of common elements between listA and listB.
 *
 * Example:
 * val listA = listOf(1, 2, 3, 4, 5, 6)
 * val listB = listOf(3, 4, 5, 6, 7, 8)
 * findCommonElements(listA, listB) // [3, 4, 5, 6]
 *
 * val listA = listOf(10, 20, 30)
 * val listB = listOf(40, 50, 60)
 * findCommonElements(listA, listB) // []
 */
fun findCommonElements(listA: List<Int>, listB: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (element in listA) {
        if (element in listB) {
            commonElements.add(element)
        }
    }
    return commonElements
}