Find the element

Report a typo

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.

Sample Input 1:

first
235245346

Sample Output 1:

null
Write 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
}
___

Create a free account to access the full topic