Leap Year

Report a typo

The function isLeapYear(year: String): Boolean takes a year as a parameter and returns true if it is a leap year. Write the correct code for the isLeapYear() function.

You don't need to implement any algorithm for leap years, just remember that if you try to create an Instant for a non-valid day, an exception is thrown.

Sample Input 1:

2024

Sample Output 1:

true
Write a program in Kotlin
import kotlinx.datetime.*

fun isLeapYear(year: String): Boolean {
// Write your code here

//
}

fun main() {
val year = readln()
println(isLeapYear(year))
}
___

Create a free account to access the full topic