easiest solution with two approach
Complexity\n- Time complexity: O(nn/2)\n\n- Space complexity: O(1)\n\n# Code\n# iterative:\n\nclass Solution {\npublic:\n    int minMaxGame(vector<int>& nums) {
# Complexity\n- Time complexity: O(n*n/2)\n\n- Space complexity: O(1)\n\n# Code\n# iterative:\n```\nclass Solution {\npublic:\n    int minMaxGame(vector<int>& nums) {\n       int n=nums.size();\n        while(n!=1){\n            int x=0;\n            for(int i=0;i<n/2;i++){\n                if(x%2==0){\n                    nums[x]=min(nums[2*i],nums[2*i+1]);\n                }\n                else{ \n                    nums[x]=max(nums[2*i],nums[2*i+1]);\n                }\n                x++;\n            }\n            n/=2;\n        }\n        return nums[0];\n    }\n    \n};\n```\n\n# Complexity\n- Time complexity: O(n*n/2)\n\n- Space complexity: O(1)\n\n# Code\n# iterative:\n```\nclass Solution {\npublic:\n    int minMaxGame(vector<int>& nums) {\n       int n=nums.size();\n        while(n!=1){\n            int x=0;\n            for(int i=0;i<n/2;i++){\n                if(x%2==0){\n                    nums[x]=min(nums[2*i],nums[2*i+1]);\n                }\n                else{ \n                    nums[x]=max(nums[2*i],nums[2*i+1]);\n                }\n                x++;\n            }\n            n/=2;\n        }\n        return nums[0];\n    }\n    \n};\n```\n# Complexity\n- Time complexity: O(n*n/2)\n\n- Space complexity: O(1)\n\n# Code\n# iterative:\n```\nclass Solution {\npublic:\n    int minMaxGame(vector<int>& nums) {\n       int n=nums.size();\n        while(n!=1){\n            int x=0;\n            for(int i=0;i<n/2;i++){\n                if(x%2==0){\n                    nums[x]=min(nums[2*i],nums[2*i+1]);\n                }\n                else{ \n                    nums[x]=max(nums[2*i],nums[2*i+1]);\n                }\n                x++;\n            }\n            n/=2;\n        }\n        return nums[0];\n    }\n    \n};\n```
['C++']