Skip to content

Instantly share code, notes, and snippets.

@gmarcial
Created May 13, 2022 01:57
Show Gist options
  • Save gmarcial/cd514510e8d54267e4d5ab5677d2a512 to your computer and use it in GitHub Desktop.
Save gmarcial/cd514510e8d54267e4d5ab5677d2a512 to your computer and use it in GitHub Desktop.
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func main() {
a := []int32{13, 20, 8, 9}
var sum int32
for i := 0; i < len(a); i++ {
for j := i; j < len(a); j++ {
if a[i] < a[j] || a[i] > a[j] {
sum += a[i] + a[j]
i += 2
j += 1
}
}
break
}
fmt.Print(sum)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment