MCPcopy Create free account
hub / github.com/EndlessCheng/codeforces-go / arraySign

Function arraySign

leetcode/weekly/236/a/a.go:4–15  ·  view source on GitHub ↗

github.com/EndlessCheng/codeforces-go

(a []int)

Source from the content-addressed store, hash-verified

2
3// github.com/EndlessCheng/codeforces-go
4func arraySign(a []int) int {
5 s := 1
6 for _, v := range a {
7 if v == 0 {
8 return 0
9 }
10 if v < 0 {
11 s *= -1
12 }
13 }
14 return s
15}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected