• + 0 comments

    Wow! Lovely Solution.. But what if the direction of rotation is left?

    I have given it a try, please let me know if I am wrong:

    if(idx+rot <= arr.length) System.out.println(arr[idx+rot]); else System.out.println(arr[arr.length-(idx+rot)]);