Is it true?

Report a typo

Write a function checkElements(), which checks if a list of names contains a certain name and returns true when the element is present in list.

Sample Input 1:

Gabrielle John Mary Brianna Jordan James Caroline Elizabeth Gilbert Morgan
Belinda

Sample Output 1:

false
false
Write a program in Kotlin
fun main() {
val nameList = readln().split(" ").toMutableList()
val nameSet = nameList.toMutableSet()
val name = readln()

println(checkElements(nameList, name))
println(checkElements(nameSet, name))
}

// Write here function checkElements()
___

Create a free account to access the full topic