Javascript time limit exceed


  • -1
    S

    ERROR MESSAGE IS:Time Limit Exceeded
    Last executed input: "babbbbaabababaabbababaababaabbaabababbaaababbababaaaaaabbabaaaabababbabbababbbaaaababbbabbbbbbbbbbaabbb", "bbbabbababbbabababbbaaaabbbbba"

    HERE IS MY JS

    `

    /**

    • @param {string} str

    • @param {string} pattern

    • @return {boolean}
      */
      var isMatch = function(str, pattern) {

      var ptn=pattern.replace(/?/g,'.').replace(/*+/g,".*");
      var reg=new RegExp(ptn);
      return reg.test(str);
      };
      `

    and i run int chrome develper tools,it give the answer very quick


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.