diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/shuffle_the_array.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/shuffle_the_array.cpp')
-rw-r--r-- | other/shuffle_the_array.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/other/shuffle_the_array.cpp b/other/shuffle_the_array.cpp deleted file mode 100644 index f7dddea..0000000 --- a/other/shuffle_the_array.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// 1470. Shuffle the Array -#include "leetcode.h" - -/* - * given array 'nums' consisting of '2n' elements in the form - * [x1, x2, ..., xn, y1, y2, ..., yn] - * return the array in the form [x1, y1, x2, y2, ..., xn, yn] - */ - -class Solution { -public: - vector<int> shuffle(vector<int> &nums, int n) { - int len = nums.size(); - for (int i = n; i < len; i++) - nums[i] = (nums[i] << 10) | nums[i - n]; - int idx = 0; - for (int i = n; i < len; i++, idx += 2) { - nums[idx] = nums[i] & 1023; - nums[idx + 1] = nums[i] >> 10; - } - return nums; - } -}; - -int main() { - Solution obj; - vector<int> nums1 = {2, 5, 1, 3, 4, 7}; - vector<int> nums2 = {1, 2, 3, 4, 4, 3, 2, 1}; - vector<int> nums3 = {1, 1, 2, 2}; - for (auto i : obj.shuffle(nums1, 3)) - cout << i << ' '; // expect: 2,3,5,4,1,7 - cout << endl; - for (auto i : obj.shuffle(nums2, 4)) - cout << i << ' '; // expect: 1,4,2,3,3,2,4,1 - cout << endl; - for (auto i : obj.shuffle(nums3, 2)) - cout << i << ' '; // expect: 1,2,1,2 - cout << endl; -} |