chore: add day13
Some checks failed
Go Bump / bump (push) Failing after 5s
Go Test / build (push) Successful in 29s

This commit is contained in:
xuu 2023-12-13 17:02:16 -07:00
parent eb758ab41d
commit aeb0b8752a
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
2 changed files with 16 additions and 6 deletions

View File

@ -1,6 +0,0 @@
???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1

View File

@ -250,3 +250,19 @@ func ABS(i int) int {
}
return i
}
func Transpose[T any](matrix [][]T) [][]T {
rows, cols := len(matrix), len(matrix[0])
m := make([][]T, cols)
for i := range m {
m[i] = make([]T, rows)
}
for i := 0; i < cols; i++ {
for j := 0; j < rows; j++ {
m[i][j] = matrix[j][i]
}
}
return m
}