SHARE
TWEET

Untitled

a guest Jun 16th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function findStartingIndex(T, pattern) {
  2.   let S = T;
  3.   const res = [];
  4.   while(true) {
  5.     const i = S.indexOf(pattern);
  6.     if (i === -1) { return res; }
  7.  
  8.     S = S.substring(i + 1);
  9.     res.push(i ? i + 1 : i);
  10.   }
  11.   return res;
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top