嗨,交换技术(我的代码)如何遭受超时问题,其中作为圆形数组
{(i+number of rotation)%length} 执行不?
a是一个int[]。
for (int i = 0; i < numberofrotation; i++) {
for (int j = 0; j < a.length-1; j++) {
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
return a;
Helenr
函数式编程
随时随地看视频慕课网APP
相关分类