Binary Search O(nmlog(nm))
class Solution {\npublic:\n    \n    long long kthSmallestProduct(vector& nums1, vector& nums2, long long k) {\n        long long hi=10000000000;\n        long 
class Solution {\npublic:\n    \n    long long kthSmallestProduct(vector<int>& nums1, vector<int>& nums2, long long k) {\n        long long hi=10000000000;\n        long long lo=-10000000000;\n        long long ans1=0;\n        while(lo<=hi){\n            long long mid=(hi+lo)/2;\n            if(countElement(nums1,nums2,mid)>=k){\n                ans1=mid;\n                hi=mid-1;\n            }\n            else{\n                lo=mid+1;\n            }\n        }\n        return ans1;\n    }\n    \n    long long countElement(vector<int> &arr1,vector<int> &arr2,long long dot_prod){\n        long long ans=0;\n        for(int i=0;i<arr1.size();i++){\n            long long count=0;\n            long long e1=arr1[i];\n            long long lo=0;\n            long long hi=arr2.size()-1;\n            if(e1>=0){\n                while(lo<=hi){\n                    int mid=(lo+hi)/2;\n                    if((long long)e1*arr2[mid]<=dot_prod){\n                        count=mid+1;\n                        lo=mid+1;\n                    }\n                    else{\n                        hi=mid-1;\n                    }\n                }\n                ans=ans+count;\n            }\n            else{\n                while(lo<=hi){\n                    int mid=(lo+hi)/2;\n                    if((long long)e1*arr2[mid]<=dot_prod){\n                        count=arr2.size()-mid;\n                        hi=mid-1;\n                    }\n                    else{\n                        lo=mid+1;\n                    }\n                }\n                ans=ans+count;\n            }\n        }\n        return ans;\n    }\n};
['C', 'Binary Tree']