We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Arrays: Left Rotation
  2. Discussions

Arrays: Left Rotation

Problem
Submissions
Leaderboard
Discussions
Editorial
Topics

    You are viewing a single comment's thread. Return to all comments →

  • patrachinmaya201
    3 months ago+ 0 comments

    Java code public static List rotLeft(List a, int d) {

        if(d==0)
        return a;
    
        while(d>0){
            Integer dup= a.get(0);
            a.remove(0);
            a.add(dup);
            d--;
        }
    
    return a;
    
    }
    
    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy