当前位置:网站首页>leetcode - 384. Scramble array
leetcode - 384. Scramble array
2022-06-25 12:58:00 【zmm_ mohua】
leetcode - 384. Scramble the array
subject

Code
#include <iostream>
#include <vector>
using namespace std;
vector<int> nums;
vector<int> original;
Solution(vector<int>& nums) {
this->nums = nums;
this->original.resize(nums.size());
copy(nums.begin(), nums.end(), original.begin());
}
vector<int> reset() {
copy(original.begin(), original.end(), nums.begin());
return nums;
}
vector<int> shuffle() {
for(int i = 0; i < nums.size(); i++){
int j = i + rand() % (nums.size() - i);
swap(nums[i], nums[j]);
}
return nums;
}
int main(){
return 0;
}
边栏推荐
- Three jobs! You can learn this from me (attached with graduation vlog)
- 康威定律,作为架构师还不会灵活运用?
- Differences between JS and JQ operation objects
- Talk about 11 key techniques of high availability
- 量化交易之回测篇 - 期货CTA策略实例(TQZFutureRenkoScalpingStrategy)
- 初识CANOpen
- [data visualization] 360 ° teaching you how to comprehensively learn visualization - Part 1
- Shell learning notes (latest update: 2022-02-18)
- 顺序表的折半查找法
- Optimal solution for cold start
猜你喜欢
随机推荐
JVM参数解释
CUDA error: unspecified launch failure
JSTL tag: fmt:formatdate tag format Chinese standard time or timestamp
AI assisted paper drawing of PPT drawing
Select randomly by weight [prefix and + dichotomy + random target]
Baidu search stability analysis story
RESTful和RPC
3+1 guarantee: how is the stability of the highly available system refined?
剑指 Offer 04. 二维数组中的查找
Geospatial search: implementation principle of KD tree
剑指 Offer II 032. 有效的变位词
剑指 Offer II 028. 展平多级双向链表
Idea2017 how to set not to automatically open a project at startup
mysql导入导出数据到excel表日期出现问题
Circular exercises of JS
Qt鼠标跟踪
最大数[抽象排序之抽象规则]
Resolved: could not find artifact XXX
Draw the satellite sky map according to the azimuth and elevation of the satellite (QT Implementation)
yolov5训练使用的负样本图片









![[AI helps scientific research] fool drawing of loss curve](/img/38/5cb2a3d33a609dab3874215d5f7b5b.png)