working on 2021/03
This commit is contained in:
parent
9d18226366
commit
55c353b141
1 changed files with 5 additions and 3 deletions
|
@ -28,8 +28,9 @@ func Part1(s []string) int {
|
|||
var store []rune
|
||||
var result []string
|
||||
resultLen := len([]rune(s[0]))
|
||||
zero, one := 0, 0
|
||||
|
||||
for x := 0; x < resultLen; x++ {
|
||||
zero, one := 0, 0
|
||||
for _, report := range s {
|
||||
chars := []rune(report)
|
||||
store = append(store, chars[x])
|
||||
|
@ -37,11 +38,12 @@ func Part1(s []string) int {
|
|||
for _, data := range store {
|
||||
switch data {
|
||||
case '0':
|
||||
zero++
|
||||
zero += 1
|
||||
case '1':
|
||||
one++
|
||||
one += 1
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println(zero, one)
|
||||
if zero < one {
|
||||
result = append(result, "1")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue