https://www.geeksforgeeks.org/minimum-number-of-bottles-required-to-fill-k-glasses/
Given N glasses having water, and a list A of each of their capacity. The task is to find the minimum number of bottles required to fill out exactly K glasses. The capacity of each bottle is 100 units.
solution
https://play.golang.org/p/31vrx6pzXUs
package main
import (
"fmt"
"math"
"sort"
)
// you can also use imports, for example:
// import "fmt"
// import "os"
// you can write to stdout for debugging purposes, e.g.
// fmt.Println("this is a debug message")
var N int = 4
var K int = 3
func Solution(N int, K int) int {
// write your code in Go 1.4
s := []int{200, 150, 140, 300}
fmt.Println(s)
sort.Ints(s)
sum := 0
var reTurn float64
fmt.Println(s)
for i := 0; i < K; i++ {
sum += s[i]
fmt.Println(sum)
}
reTurn = math.Ceil(float64(sum / 100))
fmt.Println("reTurn")
fmt.Println(reTurn)
return int(reTurn)
}
func main() {
fmt.Println("sonuc")
fmt.Println(Solution(N, K))
}