Skip to content

Commit 509e4a9

Browse files
authored
Merge pull request #17 from mairohanhoon/main
Added Basic Questions Folder
2 parents 6a37ec6 + 0c04f52 commit 509e4a9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
void reverseArray(vector<int> &arr , int m)
5+
{
6+
int n = arr.size();
7+
int j = arr.size()-1;
8+
for(int i=m+1; i<n; i++){
9+
if(i<j){
10+
swap(arr[i], arr[j]);
11+
j--;
12+
}
13+
}
14+
15+
16+
}
17+
18+
int main(){
19+
20+
int m = 3;
21+
vector<int> arr = {1, 2, 3, 4, 5, 6};
22+
23+
reverseArray(arr, m);
24+
25+
for(int i=0; i<arr.size(); i++){
26+
cout << arr[i] << " ";
27+
}
28+
29+
return 0;
30+
}
31+
61.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)