Typescript Solution Beats 100% memory and time
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nfunction minSum(nums1: number[], nums2: number[]): number {\n    let sizeNumsOne = nums1.length;\n    let sizeNumsTwo = nums2.length;\n    let numsOneZeroesCount = 0;\n    let numsTwoZeroesCount = 0;\n    let sumNumsOne = 0;\n    let sumNumsTwo = 0;\n\n    let index = 0;\n    while(index < sizeNumsOne || index < sizeNumsTwo){\n        if(index < sizeNumsOne){\n            sumNumsOne+= nums1[index];\n            if(nums1[index] === 0) numsOneZeroesCount++;\n        }\n        if(index < sizeNumsTwo){\n            sumNumsTwo+= nums2[index];\n            if(nums2[index] === 0) numsTwoZeroesCount++;\n        }\n        index++;\n    }\n\n    if(sumNumsOne+numsOneZeroesCount > sumNumsTwo+numsTwoZeroesCount){\n        let potentialSum = sumNumsOne+numsOneZeroesCount;\n        if(numsTwoZeroesCount === 0) return -1;\n        return potentialSum;\n    }else if(sumNumsOne+numsOneZeroesCount < sumNumsTwo+numsTwoZeroesCount){\n        let potentialSum = sumNumsTwo+numsTwoZeroesCount;\n        if(numsOneZeroesCount === 0) return -1;\n        return potentialSum;\n    }else{\n        return sumNumsOne+numsOneZeroesCount;\n    }\n};\n```
['TypeScript']