Added Lottery solution.
The most difficult case (sorted and not unique) is solved by dynamic programming.