add new solutions

This commit is contained in:
Yiyang Kang 2026-02-09 10:55:02 +09:00
parent 51975f3386
commit 489fa73880
Signed by: kkyy
SSH key fingerprint: SHA256:lJSbAzC3MvrSORdvIVK6h/3g+rVKJNzM7zq0MgA9WKY
13 changed files with 437 additions and 3 deletions

View file

@ -0,0 +1,17 @@
package q2073
func timeRequiredToBuy(tickets []int, k int) int {
wants := tickets[k]
totalTime := 0
for i := range tickets {
if i <= k {
totalTime += min(wants, tickets[i])
} else {
totalTime += min(wants-1, tickets[i])
}
}
return totalTime
}
var _ = timeRequiredToBuy