JS | Binary Search
Code\n\n/**\n * @param {number[]} nums1\n * @param {number[]} nums2\n * @param {number} k\n * @return {number}\n */\nvar kthSmallestProduct = function (nums1, n
# Code\n```\n/**\n * @param {number[]} nums1\n * @param {number[]} nums2\n * @param {number} k\n * @return {number}\n */\nvar kthSmallestProduct = function (nums1, nums2, k) {\n    let nums1Neg = findMaxIndexLessThanNum(nums1, 0);\n    let nums1NonPos = findMaxIndexLessThanNum(nums1, 1);\n    let nums1Length = nums1.length;\n    let nums2Length = nums2.length;\n\n    var totalNums = function (mid) {\n        let count = nums1Neg * nums2.length;\n\n        let i = 0;\n        while (i < nums1Neg) {\n            count -= findMaxIndexLessThanNum(nums2, Math.ceil(mid / nums1[i++]));\n        }\n        \n        count += (mid < 0) ? 0 : (nums1NonPos - nums1Neg) * nums2.length;\n\n        i = nums1NonPos;\n        while (i >= nums1NonPos && i < nums1Length) {\n            count += findMaxIndexLessThanNum(nums2, Math.floor(mid / nums1[i++]) + 1);\n        }\n        return count;\n    }\n\n    let min = -1e10;\n    let max = 1e10;\n    while (min < max) {\n        let mid = min + Math.floor((max - min) / 2);\n        if (totalNums(mid) >= k) {\n            max = mid;\n        } else {\n            min = mid + 1;\n        }\n    }\n\n    return min;\n};\n\n\nvar findMaxIndexLessThanNum = function (arr, num) {\n    let left = 0;\n    let right = arr.length;\n    while (left < right) {\n        let mid = left + Math.floor((right - left) / 2);\n        if (arr[mid] < num) {\n            left = mid + 1;\n        } else {\n            right = mid;\n        }\n    }\n    return left;\n}\n```
['JavaScript']