import Foundation
func solution(_ n:Int, _ arr1:[Int], _ arr2:[Int]) -> [String] {
var answer: [String] = []
var map1: [[Int]] = []
var map2: [[Int]] = []
for i in arr1 {
var answerStack: [Int] = []
var tmp = i
while tmp != 0 {
answerStack.append(tmp % 2)
tmp /= 2
}
answerStack.reverse()
while answerStack.count < n {
answerStack.insert(0, at: 0)
}
map1.append(answerStack)
}
for i in arr2 {
var answerStack: [Int] = []
var tmp = i
while tmp != 0 {
answerStack.append(tmp % 2)
tmp /= 2
}
answerStack.reverse()
while answerStack.count < n {
answerStack.insert(0, at: 0)
}
map2.append(answerStack)
}
for (index1, value) in map1.enumerated() {
var sum: [Character] = []
for (index2, value) in map2.enumerated() {
print(index1, index2)
if (map1[index1][index2] == 1) || (map2[index1][index2] == 1) {
sum.append("#")
} else {
sum.append(" ")
}
}
answer.append(sum.map { String($0) }.joined())
}
return answer
}