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. Algorithms
  3. Sorting
  4. Lily's Homework
  5. Discussions

Lily's Homework

Problem
Submissions
Leaderboard
Discussions
Editorial

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

  • abhijeetgholap01 3 years ago+ 0 comments

    I see that you're comparing elements that are out of place and incrementing number of swaps (ret) value. But that is not neccessarily, number of minimum of swaps required.

    for example, array1: 2 5 3 1 array2: 1 2 3 5

    have 3 elements out of place. but minimum number of swaps required are 2. I would appreciate you can help me understand the algorithm.

    Thanks

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