dynamic programming algorithm for weighted interval scheduling