-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path2094.cpp
More file actions
21 lines (21 loc) · 697 Bytes
/
2094.cpp
File metadata and controls
21 lines (21 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class Solution {
public:
vector<int> findEvenNumbers(vector<int>& digits) {
unordered_set<int> st;
int n = digits.size();
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
for (int k = 0; k < n; ++k) {
if (i == j || j == k || i == k) continue;
if (digits[k] & 1) continue;
if (digits[i] == 0) continue;
int num = digits[i] * 100 + digits[j] * 10 + digits[k];
st.insert(num);
}
}
}
vector<int> res(st.begin(), st.end());
sort(res.begin(), res.end());
return res;
}
};