From dc1f0c4c0096013799416664894c5194dc7e1f52 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 28 Feb 2025 23:13:39 +0800 Subject: chore(store): move everything to store. --- store/works/solutions/leetcode/cpp/15.cpp | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 store/works/solutions/leetcode/cpp/15.cpp (limited to 'store/works/solutions/leetcode/cpp/15.cpp') diff --git a/store/works/solutions/leetcode/cpp/15.cpp b/store/works/solutions/leetcode/cpp/15.cpp new file mode 100644 index 0000000..2b8f6cd --- /dev/null +++ b/store/works/solutions/leetcode/cpp/15.cpp @@ -0,0 +1,44 @@ +#include +#include + +using std::vector; + +#include +#include +#include +#include + +bool operator<(const std::vector &l, std::vector &r) { + return std::lexicographical_compare(l.cbegin(), l.cend(), r.cbegin(), + r.cend()); +} + +class Solution { +public: + int ha[100010]{0}; + + vector> threeSum(vector &nums) { + std::set> result; + + if (nums.size() < 3) + return {}; + + std::unordered_map m; + + for (auto n : nums) { + if (n >= 0) + m[n]++; + } + + for (int i = 0; i < nums.size() - 2; i++) { + for (int j = i + 1; j < nums.size() - 1; j++) { + auto v = -nums[i] - nums[j]; + if (v == 0) { + + } + } + } + + return std::vector>(result.cbegin(), result.cend()); + } +}; \ No newline at end of file -- cgit v1.2.3