class Solution {
public:
int inventoryManagement(vector<int>& stock)
{
int x = 0, votes = 0;
for(int num : stock){
if(votes == 0) x = num;
votes += num == x ? 1 : -1;
}
return x;
}
};
leetcode每日一题第九十七天
最新推荐文章于 2024-07-20 22:34:59 发布