Skip to content

Kotlin Challenges

Paul Ambrose edited this page Jul 27, 2020 · 4 revisions

Kotlin Challenges

Kotlin challenges must adhere to this general format:

package packageName

// @desc This is a description of **methodName()**

fun List<String>.methodName(): String = mapIndexed { i, s -> i.toString() + s }.joinToString(", ")

fun main() {
  println(listOf("a"). methodName())
  println(listOf("a", "b", "c", "d"). methodName())
}
  • packageName can be any valid Kotlin package name.
  • Challenge descriptions are embedded within Kotlin comments (with @desc attribute).
  • Challenge descriptions support markdown.
  • methodName can be any valid Kotlin method name.
  • Each println() will act as a separate input for the user. You can have as many as you want.
  • Please adhere to the same order of declarations as described here.