Sitemap

Binary Search — The Limits

Dec 26, 2019

--

There are lots of hard difficulty problems in leetcode that is using binary search for a simple solution. The common pattern of these problems are 1) the sequence is sorted. 2) there are limits (explicit or implicit) to the desired output. 3) there is a target (explicit or implicit) that can be binary searched and checked against the limits. One common use case scenario is min-max problems.

Get levendlee’s stories in your inbox

Join Medium for free to get updates from this writer.

668. Kth Smallest Number in Multiplication Table

  • The multiplication table is sorted row-wise / column-wise.
  • The limit is a known ranking.
  • The target is the unknown upper bound of the first kth elements.

This entry was posted in Computer Science, Data Structures & Algorithms on by .

Originally published at http://levendlee.wordpress.com on December 26, 2019.

--

--

levendlee
levendlee

Written by levendlee

Software Engineer. More links in levendlee.com.