EAZY || 90% || 30DAYS 6COMPAINES
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic: \n    vector<vector<int>> rects;\n    int i=0;\n    int x,y;\n    Solution(vector<vector<int>>& rects) {\n        this->rects=rects;\n        x=rects[i][0];\n        y=rects[i][1];\n    }\n    \n    vector<int> pick() {\n        vector<int>ans={x,y};\n        x++;\n        if(x>rects[i][2]){\n            x=rects[i][0];\n            y++;\n        }\n        if(y>rects[i][3]){\n            if(i+1<rects.size()){\n                i++;\n            }\n            else{\n                i=0;\n            }\n            x=rects[i][0];\n            y=rects[i][1];\n        }\n        return ans;\n    }\n};\n\n/**\n * Your Solution object will be instantiated and called as such:\n * Solution* obj = new Solution(rects);\n * vector<int> param_1 = obj->pick();\n */\n```\n# JOIN\n-Let\'s collaborate! Join me on GitHub to work on this challenge together :-\n-[https://github.com/MITTALBHAVYA/6companies30dayschallange]()\n# UPVOTE PLEASE\n![UPVOTE IMAGE.jpg](https://assets.leetcode.com/users/images/34aba8d9-3f42-461b-bc80-524464e916e7_1704570021.0621233.jpeg)\n
['Array', 'Math', 'Binary Search', 'Reservoir Sampling', 'Prefix Sum', 'Ordered Set', 'Randomized', 'C++']