You have a set of some numbers. From standard input, you'll receive a command – "last" or "first" – and on the next line, a certain number. Print the first or last element from the set that is strictly greater than the input number. If there isn't such an element, print null.
Null and collections
Find the element
Report a typo
Sample Input 1:
first
235245346Sample Output 1:
nullWrite a program in Kotlin
fun main() {
val set = setOf(12, 34, 235, 2343, 1, 3, 4564, 23, 5, 6, 123545, 464)
// Write 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.