Google | Coding Interview | US-Election (new question)
Anonymous User
2078

Input:
- num_states:int
- delegates: int[]
- votes_president_A: int[]
- votes_president_B: int[]
- votes_Undecided: int[]

output: the minimum number of people vote A will lead A win, output -1 if not valid (int)

example:

input1:
num_states = 3
[delegate, vote_A, vote_B, undecided)
state 1: 5 0 0 20
state 2: 4 0 0 19
state 3: 2 0 0 10

output1:
16

Input 2:
3
7 100 200 200
8 100 300 200
9 100 400 200
Output 2: -1

public int solution(int num_states, int[] delegates, int[] votes_president_A, int[]
votes_president_B, int[] votes_Undecided){
	// return minumber number people vote A
}

Any idea about this questions? I get stuck during the interview....

Comments (6)