Solving Range Module in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner.

Example 1:

addRange(10, 20): null
removeRange(14, 16): null
queryRange(10, 14): true (Every number in [10, 14) is being tracked)
queryRange(13, 15): false (Numbers like 14, 14.03, 14.17 in [13, 15) are not being tracked)
queryRange(16, 17): true (The number 16 in [16, 17) is still being tracked, despite the remove operation)


addRange(10, 20): null
removeRange(14, 16): null

See the full details of the problem Range Module at LeetCode

Originally posted at: