Can somebody explain how these two problems are different? In the marbles one it doesn't matter if the person puts it back or not, the answer will be the same, why is that not the same for the candies one, why are both solved using two different methods?

You can likely find your answer here.