/**
 * This function takes two lists and a limit as input and returns a list containing the common elements present in both input lists up to the given limit.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @param limit The maximum number of common elements to be returned.
 * @return The list containing the common elements up to the given limit.
 */
fun commonElementsWithLimit(list1: List<Int>, list2: List<Int>, limit: Int): List<Int> {

    val common = list1.filter { it in list2 }.take(limit)
    return common
}

// Exercise: Complete the 'commonElementsWithSlicing' function by adding slicing conditions using the ternary operator to get only the odd
/**
 * This function takes two lists and a limit as input and returns a list containing the common elements present in both input lists up to the given limit.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @param limit The maximum number of common elements to be returned.
 * @return The list containing the common elements up to the given limit.
 */
fun commonElementsWithLimit(list1: List<Int>, list2: List<Int>, limit: Int): List<Int> {
/**
 * This function takes two lists and a limit as input and returns a list containing the common elements present in both input lists up to the given limit.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @param limit The maximum number of common elements to be returned.
 * @return The list containing the common elements up to the given limit.
 */
fun commonElementsWithLimit(list1: List<Int>, list2: List<Int>, limit: Int): List<Int> {

    val common = list1.filter { it in list2 }.take(limit)
    return common
}

// Exercise: Complete the 'commonElementsWithSlicing' function by adding slicing conditions using the ternary operator to get only the odd