Solution without using Interval