thumbnail-for-Cheatsheet
Cheatsheet
thumbnail-for-Introducing-My-Brain-Dump
Introducing My Brain Dump
thumbnail-for-GNU-parallel-is-xargs-on-Steroids
GNU parallel is xargs on Steroids
thumbnail-for-Soak-up-Pipelines-with-sponge
Soak up Pipelines with sponge
thumbnail-for-Year-in-Review-2020
Year in Review 2020
thumbnail-for-Hamefura-S01
Hamefura S01
thumbnail-for-EDN-is-the-JSON-of-My-Dreams
EDN is the JSON of My Dreams

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.


Programmer Strings
Max Positive Slice Sum
BST In-Order Successor
Numbers Disappeared in an Array
Equal Split (2 Array)
Stone Wall

Snippet of The Day

Two Sum

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
}