import unittest

def add_binary(str1, str2):
    """
    :type str1: str
    :type str2: str
    :rtype: str
    """
    carry = 0
    result = []
    i = len(str1) - 1
    j = len(str2) - 1

    while carry or i >= 0 or j >= 0:
        total = carry

        if i >= 0:
            total += int(str1[i])
            i -= 1

        if j >= 0:
            total += int(str2[j])
            j -= 1

        result.append(str(total % 2))
        carry = total // 2

    return ''.join(result[::-1])

class Test(unittest.TestCase):
    data = [('11', '1', '100')]
    
    def test_add_binary(self):
        for test_data in self.data:
            actual = add_binary(test_data[0], test_data[1])
            self.assertEqual(actual, test_data[2])

if __name__ == '__main__':
    unittest.main()