Hot answers tagged


Interval tree is what you need to efficiently handle intervals. A simple implementation of interval tree in Solidity is provided below. Please note, it's not a balanced implementation, so in worst case it can degrade to a linked list (when you add intervals to it in ascending or descending order). It supports overlapping intervals, and search() can easily be ...

Only top voted, non community-wiki answers of a minimum length are eligible