GeeksforGeeks » C/C++ Programming Questions
Amazon question
(2 posts)-
Given two arrays , one is 1D array and other is 2D array . Now u need to
find out whether 2D array contains the subset of 1D array . The elements
of 1D array not neccessary present in the same row it can be either on the
up or down but should be continuous in the 2D array .. -
Search the 1st element of 1D array in 2D array ( there may be multiple instances) and record the row and column index for each. Now start comparing the rest of elements in 1D array with the elements left ( column--), right (column++), below (row++) and above (row--) the 1st element.
Reply
You must log in to post.