GeeksforGeeks » C/C++ Programming Questions

Amazon question

(2 posts)
  • Started 6 months ago by darkprince
  • Latest reply from Vivek

Tags:

  1. darkprince
    Member
    Posted 6 months ago #

    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 ..

  2. Vivek
    guest
    Posted 6 months ago #

    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.

RSS feed for this topic