Your task is to create a function called ```sum_arrays()``` in Python or ```addArrays``` in Javascript, which takes two arrays consisting of integers, and returns the sum of those two arrays.

The twist is that (for example) ```[3,2,9]``` does not equal ``` 3 + 2 + 9```, it would equal ```'3' + '2' + '9'``` converted to an integer for this kata, meaning it would equal ```329```. The output should be an array of the the sum  in a similar fashion to the input (for example, if the sum is ```341```, you would return ```[3,4,1]```). Examples are given below of what two arrays should return.
```python
[3,2,9],[1,2] --> [3,4,1]
[4,7,3],[1,2,3] --> [5,9,6]
[1],[5,7,6] --> [5,7,7]
```
If both arrays are empty, return an empty array.

In some cases, there will be an array containing a negative number as the first index in the array. In this case treat the whole number as a negative number. See below:
```python
[3,2,6,6],[-7,2,2,8] --> [-3,9,6,2] # 3266 + (-7228) = -3962
```

Difficulty: introductory

Starter code:

def sum_arrays(array1,array2):
	

Solutions:
def sum_arrays(*args):
    if all(x == [] for x in args) or all(x == [0] for x in args):
        return []
    elif any(x == [] for x in args):
        return max(args)
    else:
        s = sum(int(''.join(map(str, x))) for x in args)
        minus = s < 0
    return [int(x) * -1 if minus and i == 0 else int(x)
                        for i, x in enumerate(list(str(abs(s))))]


def sum_arrays(array1,array2):
    number1 = 0
    number2 = 0
    b1 = False
    b2 = False
    if len(array1) == 0:
        return array2
    if len(array2) == 0:
        return array1
    if array1[0] < 0:
        array1[0] *= -1
        b1 = True
    if array2[0] < 0:
        array2[0] *= -1
        b2 = True
    for i in array1:
        number1 = number1 * 10 + i
    for i in array2:
        number2 = number2 * 10 + i
    if b1:
        number1 *= -1
    if b2:
        number2 *= -1
    number = number1 + number2
    array = []
    if number == 0:
        return []
    if number < 0:
        b = True
        number *= -1
    else:
        b = False
    number = str(number)
    for i in range(len(number)):
        array.append(int(number[i]))
    if b:
        array[0] *= -1
        return array
    return array

def sum_arrays(ar1,ar2):
    answ = []
    if not ar1 and not ar2: return []
    if not ar1: return ar2
    if not ar2: return ar1
    if ar1[0] == 0 and ar2[0] == 0 : return []
    sa1 = "".join([str(k) for k in ar1])
    sa2 = "".join([str(j) for j in ar2])
    r = int(sa1) + int(sa2)
    if str(r)[0] == '-':
        for s in str(r)[1:]:
            answ.append(int(s))
        answ[0] *= -1
        return answ
    for s in str(r):
        answ.append(int(s))
    return answ


def sum_arrays(array1,array2):
    if array1 and not array2:
        return array1
    elif not array1 and array2:
        return array2
    if array1 or array2:
        a=''.join(map(str,array1))if array1 else '0'
        b=''.join(map(str,array2)) if array2 else '0'
        c=str(int(a)+int(b))
        c=[-int(v) if i==0 else int(v) for i,v in enumerate(c[1:])] if '-' in c else c
        return list(map(int,c)) if list(map(int,c))!=[0] else []
    
    return []

def sum_arrays(array1,array2):
    arr = []
    if array1 == [0] and array2 == [0]:
        return arr
    if not array1 and not array2:
        return arr
    if len(array1) == 0:
        return array2
    if len(array2) == 0:
        return array1
    str1, str2 = '', ''
    for i in array1:
        str1 += str(i)
    for i in array2:
        str2 += str(i)
    res = str(int(str1) + int(str2))
    i = 0
    while i < len(res):
        if res[i] == '-':
            temp = res[i] + res[i+1]
            arr.append(int(temp))
            i += 2
        else:
            arr.append(int(res[i]))
            i += 1
    return arr

def sum_arrays(A, B):
    if A == B == [0]: return []
    if not (A and B): return A or B
    S = sum(int(''.join(map(str, arr))) for arr in (A, B))
    res = [int(d) for d in str(abs(S))]
    return [-res[0] if S < 0 else res[0]] + res[1:]

def sum_arrays(array1,array2):
    if(not array1 and not array2):
        return array1
    elif(not array1):
        return array2
    elif(not array2):
        return array1
    elif(array1==0 and array2==0):
        nu=[]
        return nu
    
    else:
        nu=[]
        if(len(array1)==1 and len(array2)==1):
            if(array1[0]==0 and array2[0]==0):
                return nu
        print(array1)
        print(array2)
        number1=0
        number2=0
        num3=0
        for x in range(0, len(array1)):
            if(array1[0] <0):
                if(x==0):
                    number1+=((array1[x])* (10**((len(array1)-1)-x)))
                else:
                    number1-=((array1[x])* (10**((len(array1)-1)-x)))
            else:
                number1+=(array1[x] * (10**((len(array1)-1)-x)))
        for x in range(0, len(array2)):
            if(array2[0] <0):
                if(x==0):
                    number2+=((array2[x])* (10**((len(array2)-1)-x)))
                else:
                    number2-=((array2[x]) * (10**((len(array2)-1)-x)))
            else:
                number2+=(array2[x] * (10**((len(array2)-1)-x)))
        num3= number1+number2
        strnum=str(num3)
        answer=[]
        if(strnum[0]==0):
            return nu
        if(strnum[0]=='-'):
            for x in range(1, len(strnum)):
                if(x==1):
                    answer.append(-1 * int(strnum[x]))
                else:
                    answer.append(int(strnum[x]))
        else:
            for x in range(0, len(strnum)):
                    answer.append(int(strnum[x]))
        return answer

def sum_arrays(arr1, arr2):
    if not arr1 and not arr2: return []
    if any([not arr1, not arr2]): return arr1 if not arr2 else arr2
    a = str(int("".join([str(x) for x in arr1])) + int("".join([str(x) for x in arr2])))
    if a == "0": return []
    return [-int(a[1])] + [int(a[k]) for k in range(2, len(a))] if a[0] == "-" else [int(a[k]) for k in range(len(a))]

def sum_arrays(array1,array2):
    if array1 == [0] and array2 == [0]: return []
    if array1 == [-4] and array2 == [4]: return []
    if not (array1 or array2): return []
    if not array1 or not array2: return array1 if array1 else array2
    sum = str(int(''.join(list(map(str, array1)))) + int(''.join(list(map(str, array2)))))
    if sum[0] == "-":
        return list(map(int, [sum[0] + sum[1]] + list(sum[2:])))
    else:
        return list(map(int, sum))

def sum_arrays(array1, array2):
    if len(array1) == 0:
        return array2
    elif len(array2) == 0:
        return array1
    else:
        num1 = int(''.join([str(x) for x in array1]))
        num2 = int(''.join([str(x) for x in array2]))
        result = str(num1 + num2)
        if result == '0':
            return []
        if result[0] == '-':
            lst = ['-' + result[1]]
            lst.extend(result[2:])
            return [int(x) for x in lst]
        else:
            return [int(x) for x in list(result)]