void leftRotatebyOne(int arr[], int n){
        int temp = arr[0];
        for (int i = 0; i < n - 1; i++)
          arr[i] = arr[i + 1];
      
        arr[n-1] = temp;
      }

      Java language logo
      Left Rotate Array by one

      Java Recipes

      This code is a loop that rotates the array by one spot to the left. The temp variable stores the current position of the array after the loop.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.