My attempts at two classical coding tests

1. Animation of linear particle movement:
"There are a collection of particles. You are given a string   of 'L'
and 'R's, where 'L' denote a left moving particle and 'R' denote a right
moving particle. The moving speed is given as another parameter.
Multiple particles could stay on the same position. Give the animation
of the moving particles. "

2. How to recover data from other storage sites:
"Write a program to synchronize data sets between data   centers using
as few copies as possible"