We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Game Theory
  4. Chocolate Game
  5. Discussions

Chocolate Game

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 16 Discussions, By:

votes

Please Login in order to post a comment

  • thselvam
    6 years ago+ 1 comment

    What does Optimally in the problem description means:

    How many continuous subsequences of chocolate piles will Laurel win if both of them play optimally?

    For the sequence of 1,1,2 the exmaple said, Laurel will lose but if we play it two different ways, each win in one way: (This assumes 0,0 is a non-decreasing sequence)

    Way 1: Initial-> [1, 1, 2] [0, 1, 2] --> Laurel Moved [0, 0, 2] --> Hardy Moved [0, 0, 0] --> Laurel Moved, so Laurel won

    Way 2: Initial-> [1, 1, 2] [0, 1, 2] --> Laurel Moved [0, 1, 1] --> Hardy Moved [0, 0, 1] --> Laurel Moved [0, 0, 0] --> Hardy Moved, so Hardy won

    I understood from the following comment that 0 is a valid entry of a chocolate pile and derivatively all 0s is the final sequence where the game should stop.

    4|
    Permalink
  • andrelisci
    3 years ago+ 3 comments

    the following data is supposed to be 32 win

    10 1 3 4 4 5 8 9 9 10 10

    I counted 25. Some one can told me where i'm wrong ?

    2|
    Permalink
  • kartheek12001925
    5 months ago+ 0 comments

    can anyone explain me the problem statement. I didn't understood at all.

    0|
    Permalink
  • kartheek12001925
    5 months ago+ 0 comments

    can anyone explain me the problem statement. I didn't understood at all.

    0|
    Permalink
  • reza_mazloom
    1 year ago+ 0 comments

    I got stuck in optimally section. how can i implement optimal play of players?

    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature