Skip to content

Commit 282f034

Browse files
committed
chore: shifting cpp files
1 parent bfabbcb commit 282f034

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

cpp/1.two-sum.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33
*
44
* [1] Two Sum
55
*/
6-
6+
#include <vector>
7+
#include <iostream>
8+
#include <string>
9+
#include <algorithm>
10+
#include <unordered_map>
711
// @lc code=start
12+
using namespace std;
813
class Solution
914
{
15+
1016
public:
1117
vector<int> twoSum(vector<int> &nums, int target)
1218
{
13-
std::cout << "twoSum" << std::endl;
14-
std::unordered_map<int, int> map;
19+
cout << "twoSum" << std::endl;
20+
unordered_map<int, int> map;
1521
for (int i = 0; i < nums.size(); i++)
1622
{
1723
map[nums[i]] = i;
@@ -29,3 +35,9 @@ class Solution
2935
}
3036
};
3137
// @lc code=end
38+
int main(int argc, char const *argv[])
39+
{
40+
/* code */
41+
Solution s = Solution();
42+
return 0;
43+
}

cpp/307.range-sum-query-mutable.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* @lc app=leetcode id=307 lang=cpp
3+
*
4+
* [307] Range Sum Query - Mutable
5+
*/
6+
7+
// @lc code=start
8+
class NumArray
9+
{
10+
public:
11+
vector<int> x;
12+
int sum;
13+
NumArray(vector<int> &nums)
14+
{
15+
}
16+
17+
void update(int index, int val)
18+
{
19+
}
20+
21+
int sumRange(int left, int right)
22+
{
23+
}
24+
};
25+
26+
/**
27+
* Your NumArray object will be instantiated and called as such:
28+
* NumArray* obj = new NumArray(nums);
29+
* obj->update(index,val);
30+
* int param_2 = obj->sumRange(left,right);
31+
*/
32+
// @lc code=end
File renamed without changes.

0 commit comments

Comments
 (0)