We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defgridSearch(G,P):# Write your code hereforiinrange(len(G)):start=0whileTrue:index=G[i].find(P[0],start)ifindex==-1:breakmatch=1forjinrange(1,len(P)):if(i+j)<=(len(G)-1)andP[j]==G[i+j][index:index+c]:match+=1start=index+1ifmatch==len(P):#validateifallGandPlinesmatched.return'YES'return'NO'
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Grid Search
You are viewing a single comment's thread. Return to all comments →