当前位置:网站首页>leetcode6132. 使数组中所有元素都等于零(简单,周赛)
leetcode6132. 使数组中所有元素都等于零(简单,周赛)
2022-08-01 02:45:00 【重you小垃】


思路:大于0的数字种类
class Solution {
public:
int minimumOperations(vector<int>& nums) {
int n = nums.size();
set<int> st;
for (int i = 0; i < n; +i) {
if (nums[i]) st.insert(nums[i]);
}
return st.size();
}
};
边栏推荐
猜你喜欢

Open source project site must-have & communication area function

How to get started with YOLO?How to implement your own training set?

机器学习应该如何入门?

MYSQL Classic Interview Questions

MYSQL master-slave replication

Modern Enterprise Architecture Framework 1

MYSQL-Batch insert data

RTL8762DK Lighting/LED (3)

RTL8762DK UART (two)

项目越写越大,我是这样做拆分的
随机推荐
项目越写越大,我是这样做拆分的
High dimensional Gaussian distribution basics
SC7A20 (Silan Micro-Accelerometer) Example
MYSQL transactions
Solve the problem that when IDEA creates a new file by default, right-click, new, there is no XML file
【Make YOLO Great Again】YOLOv1-v7全系列大解析(Neck篇)
Open source project site must-have & communication area function
How to download the Keil package
Basic usage concepts of vim
What practical projects can machine learning beginners learn?
second uncle
链式编程、包、访问权限
ROS2 series of knowledge (4): understand the concept of [service]
Parse the bootargs from the device tree (dtb format data)
Key Points Estimation and Point Instance
【搜索专题】看完必会的BFS解决最短路问题攻略
IDEA does not recognize the module (there is no blue square in the lower right corner of the module)
By CSDN, torn
MYSQL Index Analysis
By Value or By Reference