Solution to Search Insert Position Problem