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

文科生都能看懂的循环移位算法 | lucifer的网络博客 #46

Open
azl397985856 opened this issue Jan 11, 2020 · 1 comment
Open

Comments

@azl397985856
Copy link
Owner

https://lucifer.ren/blog/2019/12/11/rotate-list/

lucifer的个人博客,用来记录LeeCode刷题过程和心得,以及构建大前端知识体系

@FengHanC
Copy link

FengHanC commented Jun 21, 2020

看规律解的:

function wy(arr,x){
    var len = arr.length-x;
    var tmp =[];
    var result = [];
    for(var i=x; i>0;i--){
        tmp.push(arr[arr.length-i]);
    }
    result=tmp.concat(arr);
    result.length=arr.length;
    return result;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants