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

Gold Rush

func goldRush(gMap Map) int {
	max := 0
	for i, col := range gMap {
		for j, _ := range col {
    		max = variadicMax(max, goldRushPath(gMap, i, j, 0))
		}
	}
	return max
}

func goldRushPath(gMap Map, x, y, sum int) int {
	if x < 0 || y < 0 || x >= len(gMap) || y >= len(gMap[0]) || gMap[x][y] == 0 {
		return sum
	}

	sum += gMap[x][y]
	defer (func(val int) { gMap[x][y] = val })(gMap[x][y])
	gMap[x][y] = 0

	return variadicMax(
		goldRushPath(gMap, x+1, y, sum),
		goldRushPath(gMap, x-1, y, sum),
		goldRushPath(gMap, x, y+1, sum),
		goldRushPath(gMap, x, y-1, sum),
	)
}