A near optimal data structure for a type of range query problem | Synapse