File tree 1 file changed +51
-0
lines changed
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ /// Given an input string `s` and a pattern `p`, implement regular expression
2
+ /// matching with support for `'.'` and '*' where:
3
+ ///
4
+ /// * '.' Matches any single character.
5
+ ///
6
+ /// * '*' Matches zero or more of the preceding element.
7
+ ///
8
+ /// The matching should cover the entire input string (not partial).
9
+ struct Solution ;
10
+
11
+ impl Solution {
12
+
13
+ // TODO: Implement
14
+ pub fn is_match ( _s : String , _p : String ) -> bool {
15
+ false
16
+ }
17
+
18
+ }
19
+
20
+ #[ cfg( test) ]
21
+ mod tests {
22
+ use super :: Solution ;
23
+
24
+ #[ ignore]
25
+ #[ test]
26
+ fn example_1 ( ) {
27
+ let s = "aa" . to_string ( ) ;
28
+ let p = "a" . to_string ( ) ;
29
+ let result = Solution :: is_match ( s, p) ;
30
+ assert ! ( !result) ;
31
+ }
32
+
33
+ #[ ignore]
34
+ #[ test]
35
+ fn example_2 ( ) {
36
+ let s = "aa" . to_string ( ) ;
37
+ let p = "a*" . to_string ( ) ;
38
+ let result = Solution :: is_match ( s, p) ;
39
+ assert ! ( result) ;
40
+ }
41
+
42
+ #[ ignore]
43
+ #[ test]
44
+ fn example_3 ( ) {
45
+ let s = "ab" . to_string ( ) ;
46
+ let p = ".*" . to_string ( ) ;
47
+ let result = Solution :: is_match ( s, p) ;
48
+ assert ! ( result) ;
49
+ }
50
+
51
+ }
You can’t perform that action at this time.
0 commit comments