We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2d55283 + b88aa74 commit 783c246Copy full SHA for 783c246
LeetCode/1470. Do Shuffle the Array.cpp
@@ -0,0 +1,26 @@
1
+class Solution {
2
+public:
3
+ vector<int> shuffle(vector<int>& nums, int n) {
4
+
5
+ vector<int> new1;
6
+ for(int i=0;i<=n-1;i++)
7
+ {
8
+ new1.push_back(nums[i]);
9
10
+ }
11
+ vector<int> new2;
12
+ for(int i=n;i<=2*n-1;i++)
13
14
+ new2.push_back(nums[i]);
15
16
17
+ vector<int> new3;
18
+ for(int i=0;i<n;i++)
19
20
+ new3.push_back(new1[i]);
21
+ new3.push_back(new2[i]);
22
23
24
+ return new3;
25
26
+};
0 commit comments