From 282f034a2b0d9af84b35be64937c0dda2d1c9160 Mon Sep 17 00:00:00 2001 From: GuanCong Date: Mon, 12 Sep 2022 10:16:25 +0800 Subject: [PATCH] chore: shifting cpp files --- cpp/1.two-sum.cpp | 18 +++++++++-- .../1480.running-sum-of-1-d-array.cpp | 0 cpp/307.range-sum-query-mutable.cpp | 32 +++++++++++++++++++ .../724.find-pivot-index.cpp | 0 4 files changed, 47 insertions(+), 3 deletions(-) rename 1480.running-sum-of-1-d-array.cpp => cpp/1480.running-sum-of-1-d-array.cpp (100%) create mode 100644 cpp/307.range-sum-query-mutable.cpp rename 724.find-pivot-index.cpp => cpp/724.find-pivot-index.cpp (100%) diff --git a/cpp/1.two-sum.cpp b/cpp/1.two-sum.cpp index 9100807..7f573e4 100644 --- a/cpp/1.two-sum.cpp +++ b/cpp/1.two-sum.cpp @@ -3,15 +3,21 @@ * * [1] Two Sum */ - +#include +#include +#include +#include +#include // @lc code=start +using namespace std; class Solution { + public: vector twoSum(vector &nums, int target) { - std::cout << "twoSum" << std::endl; - std::unordered_map map; + cout << "twoSum" << std::endl; + unordered_map map; for (int i = 0; i < nums.size(); i++) { map[nums[i]] = i; @@ -29,3 +35,9 @@ class Solution } }; // @lc code=end +int main(int argc, char const *argv[]) +{ + /* code */ + Solution s = Solution(); + return 0; +} diff --git a/1480.running-sum-of-1-d-array.cpp b/cpp/1480.running-sum-of-1-d-array.cpp similarity index 100% rename from 1480.running-sum-of-1-d-array.cpp rename to cpp/1480.running-sum-of-1-d-array.cpp diff --git a/cpp/307.range-sum-query-mutable.cpp b/cpp/307.range-sum-query-mutable.cpp new file mode 100644 index 0000000..9386a8f --- /dev/null +++ b/cpp/307.range-sum-query-mutable.cpp @@ -0,0 +1,32 @@ +/* + * @lc app=leetcode id=307 lang=cpp + * + * [307] Range Sum Query - Mutable + */ + +// @lc code=start +class NumArray +{ +public: + vector x; + int sum; + NumArray(vector &nums) + { + } + + void update(int index, int val) + { + } + + int sumRange(int left, int right) + { + } +}; + +/** + * Your NumArray object will be instantiated and called as such: + * NumArray* obj = new NumArray(nums); + * obj->update(index,val); + * int param_2 = obj->sumRange(left,right); + */ +// @lc code=end diff --git a/724.find-pivot-index.cpp b/cpp/724.find-pivot-index.cpp similarity index 100% rename from 724.find-pivot-index.cpp rename to cpp/724.find-pivot-index.cpp