-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2023.cpp
More file actions
46 lines (33 loc) · 918 Bytes
/
2023.cpp
File metadata and controls
46 lines (33 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
int numOfPairs(std::vector<std::string>& nums, std::string target) {
int pairs = 0;
std::unordered_map<std::string, int> freq;
std::string temp = "";
for (const auto& num : nums) {
++freq[num];
}
for(int i = 0; i < nums.size(); ++i) {
// for(int j = 0; j < nums.size(); ++j) {
// temp = nums[i];
// temp += nums[j];
// if(i != j && temp == target) {
// ++pairs;
// std::cout << "pairs: " << pairs << " " << "temp: " << temp << "\n";
// }
// }
for(const auto& j : freq) {
}
}
return pairs;
}
int main() {
std::vector<std::string> nums = {
"77","77","77","77",
};
std::string target = "7777";
std::cout << numOfPairs(nums, target);
std::cin.get();
}