This repo is for keeping shorthand frequently used operations while solving algorithmic questions
str.trim().replace("\\s+".toRegex(), " ")
str.forEach { println(it) } //where it is char str.forEachIndexed { index: Int, c: Char -> println(str[index] }
fun compareTo(other: Char): Int Return difference between ASCII decimal values, 0 if equal
charArray.joinToString() String(charArray)
If in kotlin is an expression, not a statement like in Java, so it is possible: val b: String = if (1 < 2) "yes" else "no"
break doesn't work in forEach loop, works in for loop
for (item in collection) print(item)
for (i in 1..3) { println(i) }
for (i in 6 downTo 0 step 2) { println(i) }
for (i in array.indices) { println(array[i]) }
for ((index, value) in array.withIndex()) { println("the element at $index is $value") }