Data Structures, Algorithms, Leetcode, Segment Tree, Programming.
mid, ql, qr) | query(2 * rt + 1, mid + 1, R, ql, qr); } class Solution { public: vector<int> minDifference(vector<int>& nums, vector<vector<int>>& queries) { memset(sum, 0, sizeof(sum)); int n = nums.size(); nums.insert(nums.begin(), 0); // Convert to 1-indexed build(nums, 1, 1, n); vector<int>