Sum Two Values

Given an array of integers and a value, determine if there are any two integers in the array which sum equal to the given value.

Merge Overlapping Intervals

Given an array (list) of intervals as input where each interval has a start and end timestamps. Input array is sorted by starting timestamps. You are required to merge overlapping intervals and return output array (list).

Consider below input array. Intervals (2, 10), (4, 12), (11, 13), (15, 20) are overlapping so should be merged to one big interval (2, 13). Similarly interval (15, 20) doesn’t overlap anywhere so it should be added to the merged overlapping interval list.

Finding maximum in a sliding window

So I’m trying to stay true to my resolution, write one or more article about algorithms and datastructure everyday to refresh my memory on how everything works.

Binary search algorithm, find the index of a given key

It’s been a while since I’ve been writing on the blog, so I’ve decided to start being more active and since it’s been almost 15 years since I’ve studied this in University, it can also be a good refreshment course for me as well as anyone else looking into refreshing their memory or learning.

Binary search is a very useful algorithm, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array.

Site to site with OpenVPN with TLS and FirewallD on Debian

So I needed to setup a site to site transport between our two datacenters, so our internal network will be able to communicate between the two datacenters easily.

There are a lot of ways to setup site to site VPN link between two networks, in our case let’s take a look at one way using OpenVPN.

This is quite long tutorial so get yourself a bit comfortable so we can get started.

Confirm before executing shutdown/reboot command on linux

I was rushing to leave and was still logged into a server so I wanted to shutdown my laptop, but what I didn’t notice is that I was still connected to the remote server. Luckily before pressing enter I noticed I’m not on my machine but on a remote server. So I was thinking there should be a very easy way to prevent it from happening again, to me or to anyone else.