You are viewing a single comment's thread. Return to all comments →
In java8 the problem was in String; You have to use more efficient StringBuilder instead; And of couse use only one loop to iterate over array;
here is my code snippet:
StringBuilder output = new StringBuilder(); for(int i = 0; i<n; i++) { b[i] = a[(i+k) % n]; output = output.append(b[i]).append(" "); }
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
In java8 the problem was in String; You have to use more efficient StringBuilder instead; And of couse use only one loop to iterate over array;
here is my code snippet: