Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Rotate Left k cells java

public static int [] rotateLeft(int [] source, int k) {
    int arr[] = new int[source.length];

    for (int i = 0; i < arr.length; i++){
        arr[(i - k + source.length) % source.length] = source[i];
    }

    return arr; 
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Rotate #Left #cells #java
ADD COMMENT
Topic
Name
5+7 =