/**
 * This function takes a list of colors and a minimum count as input.
 * It should return a new list containing only the colors that have a count greater than or equal to the minimum count.
 *
 * @param colorList List of colors.
 * @param minCount Minimum count of a color.
 * @return A new list containing only the colors that meet the minimum count requirement.
 *
 * Example:
 * getPopularColors(listOf("blue", "red", "green", "red", "yellow", "blue"), 2) // Output: ["red", "blue"]
 * getPopularColors(listOf("purple", "orange", "purple", "blue", "orange"), 3) // Output: []
 * getPopularColors(emptyList(), 1) // Output: []
 */
fun getPopularColors(colorList: List<String>, minCount: Int): List<String> {

    val colorCount = mutableMapOf<String, Int>()

    for (color in colorList) {
        colorCount[color] = colorCount.getOrDefault(color, 0) + 1
    }

    val popularColors = mutableListOf<String>()

    for ((color, count) in colorCount) {
        if (count >= minCount) {
            popularColors.add(color)
        }
    }

    return popularColors
}
/**
 * This function takes a list of colors and a minimum count as input.
 * It should return a new list containing only the colors that have a count greater than or equal to the minimum count.
 *
 * @param colorList List of colors.
 * @param minCount Minimum count of a color.
 * @return A new list containing only the colors that meet the minimum count requirement.
 *
 * Example:
 * getPopularColors(listOf("blue", "red", "green", "red", "yellow", "blue"), 2) // Output: ["red", "blue"]
 * getPopularColors(listOf("purple", "orange", "purple", "blue", "orange"), 3) // Output: []
 * getPopularColors(emptyList(), 1) // Output: []
 */
fun getPopularColors(colorList: List<String>, minCount: Int): List<String> {
/**
 * This function takes a list of colors and a minimum count as input.
 * It should return a new list containing only the colors that have a count greater than or equal to the minimum count.
 *
 * @param colorList List of colors.
 * @param minCount Minimum count of a color.
 * @return A new list containing only the colors that meet the minimum count requirement.
 *
 * Example:
 * getPopularColors(listOf("blue", "red", "green", "red", "yellow", "blue"), 2) // Output: ["red", "blue"]
 * getPopularColors(listOf("purple", "orange", "purple", "blue", "orange"), 3) // Output: []
 * getPopularColors(emptyList(), 1) // Output: []
 */
fun getPopularColors(colorList: List<String>, minCount: Int): List<String> {

    val colorCount = mutableMapOf<String, Int>()

    for (color in colorList) {
        colorCount[color] = colorCount.getOrDefault(color, 0) + 1
    }

    val popularColors = mutableListOf<String>()

    for ((color, count) in colorCount) {
        if (count >= minCount) {
            popularColors.add(color)
        }
    }

    return popularColors
}