Max 1D range sum

Problem Statement Given a sequence of N positive or negative numbers, find a contiguous sub-array whose numbers have the largest sum. Example: The Max 1D range sum of [−2, 1, −3, 4, −1, 2, 1, −5, 4] is 6 resulting from the [−2, 1, −3, 4, −1, 2, 1, −5,... [Read More]

Longest Increasing Subsequence

Problem Statement Given a sequence of N numbers, find the longest increasing subsequence (it’s as simple as that). Example: The length of the LIS of [10, 22, 9, 33, 21, 50, 41, 60, 80] is 6, and the LIS itself is [10, 22, 9, 33, 21, 50, 41, 60, 80]... [Read More]

Depth First Search (DFS)

Problem Statement Given a tree/graph with V vertices and E edges, search for node X General Idea | \(O(V+E)\) The main idea behind Depth First Search is to explore a node’s children first (go as deep as possible) before going back to the node’s siblings. For each node u in... [Read More]

First post of (hopefully) many to come!

I recently discovered Jekyll and decided I should start a programming blog, given all the notes and problem solutions I have accumulated on my desktop. Heck, I’ll even throw in some guides to spice things up a bit. Then maybe, just maybe, someone else, other than me, would find this... [Read More]