Compute total covered interval length | LinkedIn Interview Question