4 line cheating solution just for fun, javascript

  • 0

    This is by no mean a serious solution. I just used it to learn javascript's regular expression methods :D

    var isMatch = function(s, p) {
      var regex = new RegExp(p);
      return (s.search(regex)>-1 && s.replace(regex,"").length===0)

Log in to reply

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