an O(n) naive solution for inserting interval