Hi there, I'm Mohsin Kaleem, better known as mohkale.
You've stumbled upon my humble blog, where I write about whatever interests me and the things I get up to. Take your time, enjoy your stay, let-me know if you find any issues and feel free to reach out if you have any questions.
Snippet of The Day
fun twoSum(ts: IntArray, k: Int): Boolean {
val ts = ts.sorted() // O(n log n)
var lower = 0
var upper = ts.size-1
while (upper != lower) {
val res = ts[upper] + ts[lower]
when (res.compareTo(k)) {
-1 -> lower++
0 -> { return true }
+1 -> upper--
}
}
return false
}