title: Algorithm to distribute n objects to n different locations with minimum moves
body: <p>There are n rooms arranged in a circle and n objects. At the end of the process each room should only have 1 object in it. Initially, each room can have a random number of objects from 0 to n but the sum of all the objects in all rooms is n. What is an algorithm to move these objects so that each room only has 1 object with minimum moves, assuming that moving an object from one room to the one clockwise next to it counts as 1 move and no other movement is possible.</p>
  
  <p>Example:<br>
  n = 5<br>
  Initial situation:<br>
  room 1 = 5<br>
  room 2: 0<br>
  room 3: 0<br>
  room 4: 0<br>
  room 5: 0<br>
  Solution: 1+2+3+4 = 10 </p>