You are viewing a single comment's thread. Return to all comments →
my code in javascript
function gridSearch(G, P) { // Write your code here const n = G.length; const m = P.length; for (let i = 0; i <= n - m; i++) { // loop row for (let j = 0; j <= G[i].length - P[0].length; j++) { // loop P let check = true; for (let k = 0; k < m; k++) { if (G[i + k].substring(j, P[0].length + j) !== P[k]) { check = false; break; } } if (check) { return "YES"; } } } 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 →
my code in javascript