Top 20 coding interview problems asked in Google with solutions: Algorithmic Approach by Lin Quan

Top 20 coding interview problems asked in Google with solutions: Algorithmic Approach by Lin Quan

Author:Lin Quan [Quan, Lin]
Language: eng
Format: epub
Published: 2014-02-13T00:00:00+00:00


Astute reader will notice the following facts about this structure:

a11 is the smallest element in the first row as well as in first column

it is smallest in the whole matrix.

amn is the largest element in the last row as well as in last column

it is largest in the whole matrix.

a22 > a12 > a11a22 > a11

a22 > a21 > a11a22 > a11

These observations lead us to think that searching may proceed in phases on some submatrices of reduced sizes, thus discarding those submatrices which doesn’t contain the element we are searching for. Now this sounds like 2D analogue of binary search, dubbed as 2D Binary Search by us.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.