8 lines scala double binary search and virtual Array.reverse
scala []\nobject Solution {\n  def kthSmallestProduct(nums1: Array[Int], nums2: Array[Int], k: Long): Long =\n    def bs(check: Long => Boolean, lo: Long, hi: L
```scala []\nobject Solution {\n  def kthSmallestProduct(nums1: Array[Int], nums2: Array[Int], k: Long): Long =\n    def bs(check: Long => Boolean, lo: Long, hi: Long):Long =\n      lazy val mid = lo + (hi - lo) / 2\n      if(hi-lo<=1) hi else if(check(mid)) bs(check,lo,mid) else bs(check,mid,hi)\n    def count(mid:Long): Long = nums1.iterator.map(_.toLong).map(n1 =>\n      if(n1>=0) bs(i=>n1*nums2(i.toInt)>mid ,-1, nums2.length)\n      else nums2.length-bs(i => n1*nums2(i.toInt)<=mid,-1, nums2.length)\n    ).sum\n    bs(count(_)>=k, -10_000_000_001L, 10_000_000_000L)\n}\n```
['Array', 'Binary Search', 'Scala']