leetcode insert interval refactoring old code