File tree Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ mod longuest_palindromic;
3
3
mod longuest_sub;
4
4
mod palindrome;
5
5
mod two_sum;
6
-
6
+ mod zigzag ;
7
7
fn main ( ) {
8
8
// let result = two_sum::Solution::two_sum(nums, target);
9
9
// let result = palindrome::Solution::is_palindrome(121);
@@ -12,7 +12,11 @@ fn main() {
12
12
// let target = "pwwkew".to_string();
13
13
// let result = longuest_sub::Solution::length_of_longest_substring(target);
14
14
15
- let target = "babad" . to_string ( ) ;
16
- let result = longuest_palindromic:: Solution :: longest_palindrome ( target) ;
15
+ // let target = "babad".to_string();
16
+ // let result = longuest_palindromic::Solution::longest_palindrome(target);
17
+
18
+ let s = "PAYPALISHIRING" . to_string ( ) ;
19
+ let num_rows = 3 ;
20
+ let result = zigzag:: Solution :: convert ( s, num_rows) ;
17
21
println ! ( "{:?}" , result) ;
18
22
}
Original file line number Diff line number Diff line change
1
+ pub struct Solution ;
2
+ impl Solution {
3
+ pub fn convert ( s : String , num_rows : i32 ) -> String { }
4
+ }
5
+
6
+ #[ cfg( test) ]
7
+ mod tests {
8
+ use super :: * ;
9
+
10
+ #[ test]
11
+ fn test_1 ( ) {
12
+ let s = "PAYPALISHIRING" . to_string ( ) ;
13
+ let num_rows = 3 ;
14
+ let result = "PAHNAPLSIIGYIR" ;
15
+ assert_eq ! ( Solution :: convert( s, num_rows) , result) ;
16
+ }
17
+
18
+ #[ test]
19
+ fn test_2 ( ) {
20
+ let s = "PAYPALISHIRING" . to_string ( ) ;
21
+ let num_rows = 4 ;
22
+ let result = "PINALSIGYAHRPI" ;
23
+ assert_eq ! ( Solution :: convert( s, num_rows) , result) ;
24
+ }
25
+
26
+ #[ test]
27
+ fn test_3 ( ) {
28
+ let s = "A" . to_string ( ) ;
29
+ let num_rows = 1 ;
30
+ let result = "A" ;
31
+ assert_eq ! ( Solution :: convert( s, num_rows) , result) ;
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments