Data Structures, Algorithms, Leetcode, Segment Tree, Programming.
res; for(auto &q: queries) { // The returned mp is a bitset. auto mp = query(1, 1, n, q[0] + 1, q[1] + 1); // Convert to 1-indexed // find the first value in [q[0] + 1, q[1] + 1] int i = 0; while(i < 101 and mp[i] != 1) i++; // find the Minimum Absolute Difference in [q[0] + 1, q[1] + 1] int mi =