Voonik Interview Question: there is saha and meera playi... | Glassdoor

Interview Question

Software Engineer Interview(Student Candidate)

there is saha and meera playing a game optimally.. the game

  is always started by saha.. the game is as follows.. they choose a maximum number.. all the numbers from 1 to the chosen number are written on a paper.. a person chooses a number and marks it as visited.. this number cannot be chosen by other person.. the first one to get 3 consecutive visited nodes is considered the winner.. it is not mandatory that all should be visited by the same player.. Input: N =>limit (the max number) Output: who wins the game saha (or)meera Sample Testcase: 3 no matter whatever meera does.. saha always wins.. if saha chooses 1.. and meera chooses 3..saha chooses 2 and wins the game. if saha chooses 1 and meera chooses 2..saha chooses 3 and ends the game

Add Answers or Comments

To comment on this, Sign In or Sign Up.