You are viewing a single comment's thread. Return to all comments →
Java
static String gridSearch(String[] g, String[] p) { for(int i=0;i<=(g.length-p.length);i++) { for(int j=0;j<=(g[0].length()-p[0].length());j++) { int a=i; int c=0; if(g[i].substring(j,j+p[0].length()).equals(p[0])) { c++; for(int k=1;k<p.length;k++) { i++; if(g[i].substring(j,j+p[0].length()).equals(p[k]))c++; else break; } if(c==p.length)return "YES"; } i=a; } } return "NO"; }
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 →
Java