func solution(_a :inout[Int]) -> Int {
var zeroCount : Int=0
var oneCount : Int=0
for I in a {
if i ==0 {
zeroCount +=1
}else if i ==1{
oneCount += zeroCount
}
}
if oneCount >1000000000{
return -1
}
return oneCount
}
func solution(_a :inout[Int]) -> Int {
var zeroCount : Int=0
var oneCount : Int=0
for I in a {
if i ==0 {
zeroCount +=1
}else if i ==1{
oneCount += zeroCount
}
}
if oneCount >1000000000{
return -1
}
return oneCount
}