Coins in a Line(LintCode 394):

Problem