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

added 1470-shuffle-the-array.cpp #3385

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ If you would like to have collaborator permissions on the repo to merge your own
<sub>[0338 - Counting Bits](https://leetcode.com/problems/counting-bits/)</sub> | <sub><div align='center'>[✔️](c%2F0338-counting-bits.c)</div></sub> | <sub><div align='center'>[✔️](cpp%2F0338-counting-bits.cpp)</div></sub> | <sub><div align='center'>[✔️](csharp%2F0338-counting-bits.cs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](go%2F0338-counting-bits.go)</div></sub> | <sub><div align='center'>[✔️](java%2F0338-counting-bits.java)</div></sub> | <sub><div align='center'>[✔️](javascript%2F0338-counting-bits.js)</div></sub> | <sub><div align='center'>[✔️](kotlin%2F0338-counting-bits.kt)</div></sub> | <sub><div align='center'>[✔️](python%2F0338-counting-bits.py)</div></sub> | <sub><div align='center'>[✔️](ruby%2F0338-counting-bits.rb)</div></sub> | <sub><div align='center'>[✔️](rust%2F0338-counting-bits.rs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](swift%2F0338-counting-bits.swift)</div></sub> | <sub><div align='center'>[✔️](typescript%2F0338-counting-bits.ts)</div></sub>
<sub>[0190 - Reverse Bits](https://leetcode.com/problems/reverse-bits/)</sub> | <sub><div align='center'>[✔️](c%2F0190-reverse-bits.c)</div></sub> | <sub><div align='center'>[✔️](cpp%2F0190-reverse-bits.cpp)</div></sub> | <sub><div align='center'>[✔️](csharp%2F0190-reverse-bits.cs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](go%2F0190-reverse-bits.go)</div></sub> | <sub><div align='center'>[✔️](java%2F0190-reverse-bits.java)</div></sub> | <sub><div align='center'>[✔️](javascript%2F0190-reverse-bits.js)</div></sub> | <sub><div align='center'>[✔️](kotlin%2F0190-reverse-bits.kt)</div></sub> | <sub><div align='center'>[✔️](python%2F0190-reverse-bits.py)</div></sub> | <sub><div align='center'>[✔️](ruby%2F0190-reverse-bits.rb)</div></sub> | <sub><div align='center'>[✔️](rust%2F0190-reverse-bits.rs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](swift%2F0190-reverse-bits.swift)</div></sub> | <sub><div align='center'>[✔️](typescript%2F0190-reverse-bits.ts)</div></sub>
<sub>[0268 - Missing Number](https://leetcode.com/problems/missing-number/)</sub> | <sub><div align='center'>[✔️](c%2F0268-missing-number.c)</div></sub> | <sub><div align='center'>[✔️](cpp%2F0268-missing-number.cpp)</div></sub> | <sub><div align='center'>[✔️](csharp%2F0268-missing-number.cs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](go%2F0268-missing-number.go)</div></sub> | <sub><div align='center'>[✔️](java%2F0268-missing-number.java)</div></sub> | <sub><div align='center'>[✔️](javascript%2F0268-missing-number.js)</div></sub> | <sub><div align='center'>[✔️](kotlin%2F0268-missing-number.kt)</div></sub> | <sub><div align='center'>[✔️](python%2F0268-missing-number.py)</div></sub> | <sub><div align='center'>[✔️](ruby%2F0268-missing-number.rb)</div></sub> | <sub><div align='center'>[✔️](rust%2F0268-missing-number.rs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](swift%2F0268-missing-number.swift)</div></sub> | <sub><div align='center'>[✔️](typescript%2F0268-missing-number.ts)</div></sub>
<sub>[1470 - Shuffle the Array](https://leetcode.com/problems/shuffle-the-array/)</sub> | <sub><div align='center'>[✔️](c%2F1470-shuffle-the-array.c)</div></sub> | <sub><div align='center'></div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](go%2F1470-shuffle-the-array.go)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](javascript%2F1470-shuffle-the-array.js)</div></sub> | <sub><div align='center'>[✔️](kotlin%2F1470-shuffle-the-array.kt)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](rust%2F1470-shuffle-the-array.rs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](typescript%2F1470-shuffle-the-array.ts)</div></sub>
<sub>[1470 - Shuffle the Array](https://leetcode.com/problems/shuffle-the-array/)</sub> | <sub><div align='center'>[✔️](c%2F1470-shuffle-the-array.c)</div></sub> | <sub><div align='center'>[✔️](cpp%2F1470-shuffle-the-array.cpp)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](go%2F1470-shuffle-the-array.go)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](javascript%2F1470-shuffle-the-array.js)</div></sub> | <sub><div align='center'>[✔️](kotlin%2F1470-shuffle-the-array.kt)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](rust%2F1470-shuffle-the-array.rs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](typescript%2F1470-shuffle-the-array.ts)</div></sub>
<sub>[0989 - Add to Array-Form of Integer](https://leetcode.com/problems/add-to-array-form-of-integer/)</sub> | <sub><div align='center'>[✔️](c%2F0989-add-to-array-form-of-integer.c)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](go%2F0989-add-to-array-form-of-integer.go)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](javascript%2F0989-add-to-array-form-of-integer.js)</div></sub> | <sub><div align='center'>[✔️](kotlin%2F0989-add-to-array-form-of-integer.kt)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](rust%2F0989-add-to-array-form-of-integer.rs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](typescript%2F0989-add-to-array-form-of-integer.ts)</div></sub>
<sub>[0371 - Sum of Two Integers](https://leetcode.com/problems/sum-of-two-integers/)</sub> | <sub><div align='center'>[✔️](c%2F0371-sum-of-two-integers.c)</div></sub> | <sub><div align='center'>[✔️](cpp%2F0371-sum-of-two-integers.cpp)</div></sub> | <sub><div align='center'>[✔️](csharp%2F0371-sum-of-two-integers.cs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](go%2F0371-sum-of-two-integers.go)</div></sub> | <sub><div align='center'>[✔️](java%2F0371-sum-of-two-integers.java)</div></sub> | <sub><div align='center'>[✔️](javascript%2F0371-sum-of-two-integers.js)</div></sub> | <sub><div align='center'>[✔️](kotlin%2F0371-sum-of-two-integers.kt)</div></sub> | <sub><div align='center'>[✔️](python%2F0371-sum-of-two-integers.py)</div></sub> | <sub><div align='center'>[✔️](ruby%2F0371-sum-of-two-integers.rb)</div></sub> | <sub><div align='center'>[✔️](rust%2F0371-sum-of-two-integers.rs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](swift%2F0371-sum-of-two-integers.swift)</div></sub> | <sub><div align='center'>[✔️](typescript%2F0371-sum-of-two-integers.ts)</div></sub>
<sub>[0007 - Reverse Integer](https://leetcode.com/problems/reverse-integer/)</sub> | <sub><div align='center'>[✔️](c%2F0007-reverse-integer.c)</div></sub> | <sub><div align='center'>[✔️](cpp%2F0007-reverse-integer.cpp)</div></sub> | <sub><div align='center'>[✔️](csharp%2F0007-reverse-integer.cs)</div></sub> | <sub><div align='center'>❌</div></sub> | <sub><div align='center'>[✔️](go%2F0007-reverse-integer.go)</div></sub> | <sub><div align='center'>[✔️](java%2F0007-reverse-integer.java)</div></sub> | <sub><div align='center'>[✔️](javascript%2F0007-reverse-integer.js)</div></sub> | <sub><div align='center'>[✔️](kotlin%2F0007-reverse-integer.kt)</div></sub> | <sub><div align='center'>[✔️](python%2F0007-reverse-integer.py)</div></sub> | <sub><div align='center'>[✔️](ruby%2F0007-reverse-integer.rb)</div></sub> | <sub><div align='center'>[✔️](rust%2F0007-reverse-integer.rs)</div></sub> | <sub><div align='center'>[✔️](scala%2F0007-reverse-integer.scala)</div></sub> | <sub><div align='center'>[✔️](swift%2F0007-reverse-integer.swift)</div></sub> | <sub><div align='center'>[✔️](typescript%2F0007-reverse-integer.ts)</div></sub>
Expand Down
13 changes: 13 additions & 0 deletions cpp/1470-shuffle-the-array.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution {
public:
vector<int> shuffle(vector<int>& nums, int n)
{
vector<int> temp;
for(int i=0;i<n;i++)
{
temp.emplace_back(nums[i]);
temp.emplace_back(nums[n+i]);
}
return temp;
}
};