/**
 * Given a list of integers 'lst' and an integer 'num', multiply each element in 'lst' by 'num' if it is present in the list.
 *
 * @param lst a list of integers
 * @param num an integer
 * @return updatedList the modified list with elements multiplied by 'num' (if present)
 *
 * Example:
 * multiplyIfExists(listOf(1, 2, 3, 4, 5), 2)
 * Output: [2, 4, 6, 8, 10]
 */
fun multiplyIfExists(lst: List<Int>, num: Int): List<Int> {

    val updatedList = mutableListOf<Int>()
    for (element in lst) {
        if (element in lst) {
            updatedList.add(element * num)
        } else {
            updatedList.add(element)
        }
    }
    return updatedList
}
/**
 * Given a list of integers 'lst' and an integer 'num', multiply each element in 'lst' by 'num' if it is present in the list.
 *
 * @param lst a list of integers
 * @param num an integer
 * @return updatedList the modified list with elements multiplied by 'num' (if present)
 *
 * Example:
 * multiplyIfExists(listOf(1, 2, 3, 4, 5), 2)
 * Output: [2, 4, 6, 8, 10]
 */
fun multiplyIfExists(lst: List<Int>, num: Int): List<Int> {
/**
 * Given a list of integers 'lst' and an integer 'num', multiply each element in 'lst' by 'num' if it is present in the list.
 *
 * @param lst a list of integers
 * @param num an integer
 * @return updatedList the modified list with elements multiplied by 'num' (if present)
 *
 * Example:
 * multiplyIfExists(listOf(1, 2, 3, 4, 5), 2)
 * Output: [2, 4, 6, 8, 10]
 */
fun multiplyIfExists(lst: List<Int>, num: Int): List<Int> {

    val updatedList = mutableListOf<Int>()
    for (element in lst) {
        if (element in lst) {
            updatedList.add(element * num)
        } else {
            updatedList.add(element)
        }
    }
    return updatedList
}