当前位置:网站首页>Leetcode January 13 daily question 747 At least twice the maximum number of other numbers
Leetcode January 13 daily question 747 At least twice the maximum number of other numbers
2022-06-12 06:22:00 【Well, let me see】
747. At least twice the maximum number of other numbers 
Dish title , I don't think anyone will read this blog .
AC Code :
class Solution {
public:
int dominantIndex(vector<int>& nums) {
int n = nums.size();
if(n == 1)
return 0;
int max = 0;
int res;
for(int i = 0; i < n; i++)
if(nums[i] > max) {
res = i;
max = nums[i];
}
sort(nums.begin(), nums.end());
if(nums[n - 1] >= nums[n - 2] * 2)
return res;
return -1;
}
};
边栏推荐
- Information content security experiment of Harbin Institute of Technology
- Overview of camera image quality
- R language homework (IV): GDP value analysis of Shanghai and Tokyo from 1997 to 2018
- QT--实现TCP通信
- Directx11 advanced tutorial tiled based deffered shading
- zip 和.items()区别
- Tips for using the potplayer video player
- Why is the union index the leftmost matching principle?
- Redis队列
- (UE4 4.27) customize globalshader
猜你喜欢

About why GPU early-z reduces overdraw

Multithreading (4) -- no lock (2) -- Atomic related atomic classes

Opencv_ 100 questions_ Chapter V (21-25)

Leetcode-1535. Find the winner of the array game

In unity3d, billboard effect can be realized towards another target

哈工大信息内容安全实验

Leetcode-1706. Where does the club fall

UE4 4.27 modify the mobile forward pipeline to support cluster multi light source culling

Information content security experiment of Harbin Institute of Technology

Video fire detection based on Gaussian mixture model and multi-color
随机推荐
Cross compile libev
Leetcode-139. Word splitting
How to increase heap size of JVM [duplicate] - how to increase heap size of JVM [duplicate]
Findasync and include LINQ statements - findasync and include LINQ statements
Why doesn't the database use binary tree, red black tree, B tree and hash table? Instead, a b+ tree is used
Leetcode-1705. Maximum number of apples to eat
RMB classification II
MNIST handwritten data recognition by CNN
JS预解析
MLP sensor
C2w model - language model
Solution to the problem of the 80th fortnight competition of leetcode
Bert use
Bert Chinese classification model training + reasoning + deployment
sqlite交叉编译动态库
Automatic modeling of Interchange
Une explication du 80e match bihebdomadaire de leetcode
Understand Houdini's (heightfield) remap operation
zip 和.items()区别
IBL of directx11 advanced tutorial PBR (3)