/**
 * This exercise requires finding the common elements between two arrays using the 'in' operator.
 *
 * In this case, the arrays represent sets of genes that are present in two different biological samples.
 * The goal is to find and return the common genes between the two samples.
 *
 * @param list1 A list containing gene names for the first biological sample.
 * @param list2 A list containing gene names for the second biological sample.
 * @return A list of common genes between the two samples.
 *
 * Example:
 * commonElements(listOf("gene1", "gene2", "gene3"), listOf("gene2", "gene3", "gene4"))
 * Output: ["gene2", "gene3"]
 */
fun commonElements(list1: List<String>, list2: List<String>): List<String> {

    val commonGenes = mutableListOf<String>()

    for (gene in list1) {
        if (gene in list2) {
            commonGenes.add(gene)
        }
    }

    return commonGenes
}
/**
 * This exercise requires finding the common elements between two arrays using the 'in' operator.
 *
 * In this case, the arrays represent sets of genes that are present in two different biological samples.
 * The goal is to find and return the common genes between the two samples.
 *
 * @param list1 A list containing gene names for the first biological sample.
 * @param list2 A list containing gene names for the second biological sample.
 * @return A list of common genes between the two samples.
 *
 * Example:
 * commonElements(listOf("gene1", "gene2", "gene3"), listOf("gene2", "gene3", "gene4"))
 * Output: ["gene2", "gene3"]
 */
fun commonElements(list1: List<String>, list2: List<String>): List<String> {
/**
 * This exercise requires finding the common elements between two arrays using the 'in' operator.
 *
 * In this case, the arrays represent sets of genes that are present in two different biological samples.
 * The goal is to find and return the common genes between the two samples.
 *
 * @param list1 A list containing gene names for the first biological sample.
 * @param list2 A list containing gene names for the second biological sample.
 * @return A list of common genes between the two samples.
 *
 * Example:
 * commonElements(listOf("gene1", "gene2", "gene3"), listOf("gene2", "gene3", "gene4"))
 * Output: ["gene2", "gene3"]
 */
fun commonElements(list1: List<String>, list2: List<String>): List<String> {

    val commonGenes = mutableListOf<String>()

    for (gene in list1) {
        if (gene in list2) {
            commonGenes.add(gene)
        }
    }

    return commonGenes
}