mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-10-31 18:37:48 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			305 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			305 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // File: max_capacity_test.go
 | |
| // Created Time: 2023-07-23
 | |
| // Author: Reanon (793584285@qq.com)
 | |
| 
 | |
| package chapter_greedy
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"testing"
 | |
| )
 | |
| 
 | |
| func TestMaxCapacity(t *testing.T) {
 | |
| 	ht := []int{3, 8, 5, 2, 7, 7, 3, 4}
 | |
| 
 | |
| 	// 贪心算法
 | |
| 	res := maxCapacity(ht)
 | |
| 	fmt.Println("最大容量为", res)
 | |
| }
 | 
