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.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  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 →

  • david_varela 4 years ago+ 0 comments

    It can be optimized in terms of space if you don't store the whole array, but only the rotated elements. If the elements are 1 2 3 ... 100000, and the number of left rotations is 2, you can save the first two elements (1 and 2) and directly print the rest as soon as you read them. Finally, print the saved ones. The difference in space is from 100000 ints to 2 ints.

    0|
    ParentPermalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature