Posted on January 13, 2022January 13, 2022 Description Submission class Solution { public: int dominantIndex(vector<int>& nums) { auto it = max_element(nums.begin(), nums.end()); for(auto x: nums) { if(x == *it) continue; if(*it < 2 * x) return -1; } return it - nums.begin(); } }; By Bill0412 Easy LeetCode