Sahilamin219's blog

By Sahilamin219, history, 13 days ago, In English

I was doing this question asked in recent HackFest in Hackerrank . I know its too simple but anyhow i m not able to score all 20 points.

my code

Please help ..i m not able to find the solution.

 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it

»
13 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Sahilamin219 (previous revision, new revision, compare).

»
13 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Sahilamin219 (previous revision, new revision, compare).

»
13 days ago, # |
  Vote: I like it 0 Vote: I do not like it

If two players are playing a game, note that one of them can always force the game to go till only a single element remains.

»
13 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Hey!
So here would be my solution to the problem:

def whoIsTheWinner(arr):
  n = len(arr)
  N = len(set(arr))
  if (n != N) and (n % 2 == 0):
    return "Second"
  else:
    return "First"