Game of Chocolates
Medium Accuracy: 13.82% Submissions: 376 Points: 4

Bunty and Dolly are playing a game, described as follows.
There are two boxes having A and B number of chocolates respectively. Both can eat L (L ≥ 1) chocolates from any one box or L chocolates from both the boxes in one move. They play the game alternatively and the last one to eat the chocolate will be the winner.
As Bunty wants to impress Dolly, he wants to make Dolly the winner. You have to help Bunty in deciding who should play first. Assume that both the players play optimally.

Example 1:

A = 1 and B = 2
Output: Bunty
If Bunty starts first, all the next possible state
(0,2), (1,1), (1,0) are wining state for Dolly

Example 2:

A = 1 and B = 3
Output: Dolly

Your Task:  
You don't need to read input or print anything. Your task is to complete the function solve() which takes the integer A and B as input parameters and returns false if Bunty should play first else returns true.

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

0 ≤ a, b ≤ 106

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Game of Chocolates

Output Window