|  | @@ -0,0 +1,28 @@
 | 
	
		
			
				|  |  | +func predictPartyVictory(senate string) string {
 | 
	
		
			
				|  |  | +	radiant, dire := make([]int, 0), make([]int, 0)
 | 
	
		
			
				|  |  | +	for i := range senate {
 | 
	
		
			
				|  |  | +		if senate[i] == 'R' {
 | 
	
		
			
				|  |  | +			radiant = append(radiant, i)
 | 
	
		
			
				|  |  | +		} else {
 | 
	
		
			
				|  |  | +			dire = append(dire, i)
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	r, d, n := len(radiant), len(dire), len(senate)
 | 
	
		
			
				|  |  | +	for r != 0 && d != 0 {
 | 
	
		
			
				|  |  | +		if radiant[0] < dire[0] {
 | 
	
		
			
				|  |  | +			dire = dire[1:]
 | 
	
		
			
				|  |  | +			d--
 | 
	
		
			
				|  |  | +			i := radiant[0] + n
 | 
	
		
			
				|  |  | +			radiant = append(radiant[1:], i)
 | 
	
		
			
				|  |  | +		} else {
 | 
	
		
			
				|  |  | +			radiant = radiant[1:]
 | 
	
		
			
				|  |  | +			r--
 | 
	
		
			
				|  |  | +			i := dire[0] + n
 | 
	
		
			
				|  |  | +			dire = append(dire[1:], i)
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	if r == 0 {
 | 
	
		
			
				|  |  | +		return "Dire"
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	return "Radiant"
 | 
	
		
			
				|  |  | +}
 |