diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a3b2b51 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "vector": "cpp" + } +} \ No newline at end of file diff --git a/LeetCode/Concatenation-of-Array/C++/Readme.md b/LeetCode/Concatenation-of-Array/C++/Readme.md new file mode 100644 index 0000000..c92debc --- /dev/null +++ b/LeetCode/Concatenation-of-Array/C++/Readme.md @@ -0,0 +1,5 @@ +How to run the file + +cpp``` + g++ fileName.cpp +``` \ No newline at end of file diff --git a/LeetCode/Concatenation-of-Array/C++/Solution.cpp b/LeetCode/Concatenation-of-Array/C++/Solution.cpp new file mode 100644 index 0000000..1ca2269 --- /dev/null +++ b/LeetCode/Concatenation-of-Array/C++/Solution.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; + +vector concatArray(vector &arr) +{ + vector temp; + for (int i = 0; i < arr.size(); i++) + { + temp.push_back(arr[i]); + } + for (int i = 0; i < arr.size(); i++) + { + temp.push_back(arr[i]); + } + return temp; +} + +int main() +{ + long long num; + cin >> num; + + vector arr(num); + + for (int i = 0; i < num; i++) + { + cin >> arr[i]; + } + + vector temp = concatArray(arr); + + for (int i = 0; i < temp.size(); i++) + { + cout << temp[i] << " "; + } +} \ No newline at end of file diff --git a/LeetCode/Concatenation-of-Array/C++/Solution.png b/LeetCode/Concatenation-of-Array/C++/Solution.png new file mode 100644 index 0000000..2edc7d7 Binary files /dev/null and b/LeetCode/Concatenation-of-Array/C++/Solution.png differ