Skip to content

Commit

Permalink
chore: shifting cpp files
Browse files Browse the repository at this point in the history
  • Loading branch information
Guardiaans committed Sep 12, 2022
1 parent bfabbcb commit 282f034
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cpp/1.two-sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
*
* [1] Two Sum
*/

#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <unordered_map>
// @lc code=start
using namespace std;
class Solution
{

public:
vector<int> twoSum(vector<int> &nums, int target)
{
std::cout << "twoSum" << std::endl;
std::unordered_map<int, int> map;
cout << "twoSum" << std::endl;
unordered_map<int, int> map;
for (int i = 0; i < nums.size(); i++)
{
map[nums[i]] = i;
Expand All @@ -29,3 +35,9 @@ class Solution
}
};
// @lc code=end
int main(int argc, char const *argv[])
{
/* code */
Solution s = Solution();
return 0;
}
File renamed without changes.
32 changes: 32 additions & 0 deletions cpp/307.range-sum-query-mutable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* @lc app=leetcode id=307 lang=cpp
*
* [307] Range Sum Query - Mutable
*/

// @lc code=start
class NumArray
{
public:
vector<int> x;
int sum;
NumArray(vector<int> &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
File renamed without changes.

0 comments on commit 282f034

Please sign in to comment.