Optimal Merge Pattern Problems