add new solutions
This commit is contained in:
parent
9a10695e8c
commit
ca24d0a56a
30 changed files with 697 additions and 16 deletions
13
solutions/17/q1732/solution.go
Normal file
13
solutions/17/q1732/solution.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package q1732
|
||||
|
||||
func largestAltitude(gain []int) int {
|
||||
alt := 0
|
||||
max_ := 0
|
||||
for _, g := range gain {
|
||||
alt += g
|
||||
max_ = max(alt, max_)
|
||||
}
|
||||
return max_
|
||||
}
|
||||
|
||||
var _ = largestAltitude
|
||||
19
solutions/17/q1768/solution.go
Normal file
19
solutions/17/q1768/solution.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package q1768
|
||||
|
||||
import "strings"
|
||||
|
||||
func mergeAlternately(word1 string, word2 string) string {
|
||||
builder := strings.Builder{}
|
||||
for i := range max(len(word1), len(word2)) {
|
||||
if i < len(word1) {
|
||||
builder.WriteByte(word1[i])
|
||||
}
|
||||
if i < len(word2) {
|
||||
builder.WriteByte(word2[i])
|
||||
}
|
||||
}
|
||||
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
var _ = mergeAlternately
|
||||
Loading…
Add table
Add a link
Reference in a new issue