The containsKeyAndValue function gets map: Map < String, String > and the string value: String as input parameters. If the map contains one or more keys that are equal to value and one or more values that are equal to value, the function returns true, otherwise it returns false.
Map
Is there a key?
Report a typo
Sample Input 1:
{one to two}, {three to one}, {four to five}
oneSample Output 1:
trueSample Input 2:
{10 to 20}, {30 to 1}, {55 to 23}
55Sample Output 2:
falseWrite a program in Kotlin
fun containsKeyAndValue(map: Map<String, String>, value: String): Boolean {
// put your code here
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.