668. Kth Smallest Number in Multiplication Table

Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number quickly from the multiplication table?

Given the height m and the length n of a m * n Multiplication Table, and a positive integer k, you need to return the k-th smallest number in this table.

Example 1:

Example 2:

Note:

  1. The m and n will be in the range [1, 30000].
  2. The k will be in the range [1, m * n]

awice's solution

 

Leave a Reply

Your email address will not be published. Required fields are marked *