Implement BinaryAdd to add two binary numbers together. The numbers should not be translated out of binary at any point.
Note the two inputs will always have the same length.
import type { Equal, Expect } from '@type-challenges/utils'
type cases = [
Expect<Equal<
BinaryAdd<[1], [1]>,
[1, 0]
>>,
Expect<Equal<
BinaryAdd<[0], [1]>,
[1]
>>,
Expect<Equal<
BinaryAdd<[1, 1, 0], [0, 0, 1]>,
[1, 1, 1]
>>,
Expect<Equal<
BinaryAdd<[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]>,
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]
>>,
Expect<Equal<
BinaryAdd<[1, 0, 1, 0, 1, 1, 1, 0], [1, 0, 0, 0, 1, 1, 0, 0]>,
[1, 0, 0, 1, 1, 1, 0, 1, 0]
>>,
]