Hackerrank : Chocolate feast( editorial inspired )