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

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Data Structures
  3. Arrays
  4. Left Rotation
  5. Discussions

Left Rotation

Problem
Submissions
Leaderboard
Discussions
Editorial

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

  • vcoolkaushik
    1 year ago+ 0 comments

    C# Solution - Basically you want to first convert List to Array type cuz you want to use range operator which makes it easy to dissect arrays. Lastly you want to append those two arrays and convert it back to list.

     var x = arr.ToArray();
            int[] a = x[..d];
            int[] b = x[d..];
            List<int> c = new []{ b, a}.SelectMany(s => s).ToList();
            return c;
    
    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy