Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ Solution for #359 #360

Merged
merged 3 commits into from Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions Arrays/Arrays-DS/solution.cpp
@@ -0,0 +1,26 @@
#include <bits/stdc++.h>

using namespace std;
/* Complete the reverseArray function below.
Time Complexity - O(n)
*/
void reverseArray(int a[], int size) {
for(int i=size-1; i>=0; i--) // Iterating backwards over the elements of an array
{
cout<<a[i]<<" ";
}
}

int main()
{
unsigned long int size; // Entering size of an array
cin>>size;
int a[1000];

for(int i=0; i<size; i++)
{
cin>>a[i]; // Enter elemnets of an array
}
reverseArray(a,size);
return 0;
}
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -18,7 +18,7 @@ Please read [contribution guidelines](CONTRIBUTING.md) for contributing to the p
||[2D Array-DS](https://www.hackerrank.com/challenges/2d-array/problem)|Easy|[View](Arrays/2D%20Array-DS/solution.cpp)|[View](/Arrays/2D%20Array-DS/solution.java)|[View](/Arrays/2D%20Array-DS/solution.py)|
||[Dynamic Array](https://www.hackerrank.com/challenges/dynamic-array/problem)|Easy| [View](Arrays/Dynamic%20Array/solution.cpp) |[View](Arrays/Dynamic%20Array/solution.java)|[View](Arrays/Dynamic%20Array/solution.py)|
||[Left Rotation](https://www.hackerrank.com/challenges/array-left-rotation/problem)|Easy|[View](/Arrays/Left%20Rotation/solution.cpp)|[View](/Arrays/Left%20Rotation/solution.java)|[View](/Arrays/Left%20Rotation/solution.py)|
||[Arrays-DS](https://www.hackerrank.com/challenges/arrays-ds/problem)|Easy|||[View](Arrays/Arrays-DS/solution.py)|
||[Arrays-DS](https://www.hackerrank.com/challenges/arrays-ds/problem)|Easy|[View](Arrays/Arrays-DS/solution.cpp)||[View](Arrays/Arrays-DS/solution.py)|
||[Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays/problem)|Medium|[View](Arrays/Sparse%20Arrays/solution.cpp)|[View](Arrays/Sparse%20Arrays/solution.java)|[View](Arrays/Sparse%20Arrays/solution.py)|
||[Array Manipulation](https://www.hackerrank.com/challenges/crush/problem)|Hard|[View](Arrays/Array%20Manipulation/solution.cpp)|[View](Arrays/Array%20Manipulation/solution.java)|[View](/Arrays/Array%20Manipulation/solution.py)|
| Linked Lists |
Expand Down