regular-expression-matching.dart (399B)
1 //Based on the regexp p return true if s is a match of it. 2 //I used the built in regexp checker for dart because work smarter 3 //not harder. The time complexity of this is O(n) where n is the length 4 //of the string. 5 //Time: 654ms Beats: 35% 6 //Memory: 162.9MB Beats: 50% 7 class Solution { 8 bool isMatch(String s, String p) { 9 RegExp regex = RegExp('^$p\$'); 10 return regex.hasMatch(s); 11 } 12 }