/**
 * Given two lists of minerals, this function finds the intersection of the two lists.
 *
 * @param minerals1 A list of minerals.
 * @param minerals2 Another list of minerals.
 * @return A list of common minerals found in both input lists.
 *
 * Example:
 * findCommonMinerals(listOf("quartz", "calcite", "feldspar"), listOf("apatite", "calcite", "quartz"))
 * Output: ["calcite", "quartz"]
 */
fun findCommonMinerals(minerals1: List<String>, minerals2: List<String>): List<String> {

    val commonMinerals = mutableListOf<String>()
    for (mineral in minerals1) {
        if (minerals2.contains(mineral)) {
            commonMinerals.add(mineral)
        }
    }
    return commonMinerals
}
/**
 * Given two lists of minerals, this function finds the intersection of the two lists.
 *
 * @param minerals1 A list of minerals.
 * @param minerals2 Another list of minerals.
 * @return A list of common minerals found in both input lists.
 *
 * Example:
 * findCommonMinerals(listOf("quartz", "calcite", "feldspar"), listOf("apatite", "calcite", "quartz"))
 * Output: ["calcite", "quartz"]
 */
fun findCommonMinerals(minerals1: List<String>, minerals2: List<String>): List<String> {
/**
 * Given two lists of minerals, this function finds the intersection of the two lists.
 *
 * @param minerals1 A list of minerals.
 * @param minerals2 Another list of minerals.
 * @return A list of common minerals found in both input lists.
 *
 * Example:
 * findCommonMinerals(listOf("quartz", "calcite", "feldspar"), listOf("apatite", "calcite", "quartz"))
 * Output: ["calcite", "quartz"]
 */
fun findCommonMinerals(minerals1: List<String>, minerals2: List<String>): List<String> {

    val commonMinerals = mutableListOf<String>()
    for (mineral in minerals1) {
        if (minerals2.contains(mineral)) {
            commonMinerals.add(mineral)
        }
    }
    return commonMinerals
}