C++ || Easy-to-understand || 2 Approaches
Method 1:-Brute Force\n\nclass Solution {\npublic:\n    int minMaxGame(vector<int>& nums) {\n        int n=nums.size();\n        if(n==1) return nums[0];\n     
**Method 1:-Brute Force**\n```\nclass Solution {\npublic:\n    int minMaxGame(vector<int>& nums) {\n        int n=nums.size();\n        if(n==1) return nums[0];\n        int i=0;\n        bool f=false;\n        vector<int> v;\n        while(i<n){\n            if(!f){\n              v.push_back(min(nums[i],nums[i+1]));\n            }\n            else{\n                v.push_back(max(nums[i],nums[i+1]));\n            }\n            f=!f;\n            i+=2;\n        if(i == n){\n             nums = v;\n             v.clear();\n             n = n/2;\n             i = 0;\n             if(n == 1) return nums[0];\n          } \n        }\n        return -1;\n    }\n};\n```\n**Method 2:- Recursion**\n\n```\nclass Solution {\npublic:\n    int minMaxGame(vector<int>& nums) {\n        int n=nums.size();\n        if(n==1) return nums[0];\n        vector<int> newnums(n/2);\n        for(int i=0;i<n/2;i++){\n            if(i%2==0){\n                newnums[i]=min(nums[2*i],nums[2*i+1]);\n            }\n            else{\n                newnums[i]=max(nums[2*i],nums[2*i+1]);\n            }\n        }\n        int res=minMaxGame(newnums);\n        return res;\n    }\n};\n```\n**Don\'t forget to upvote this post if it has helped you!!!**
[]