File tree 2 files changed +55
-1
lines changed
2 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ pub mod add_two_numbers; // 2
19
19
pub mod length_of_longest_substring; // 3 ✓
20
20
pub mod median_of_two_sorted_arrays; // 4
21
21
pub mod longest_palindromic_substring; // 5
22
-
22
+ pub mod zigzag_conversion ; // 6
23
23
pub mod reverse_integer; // 7
24
24
pub mod string_to_integer; // 8
25
25
pub mod palindrome_number; // 9
Original file line number Diff line number Diff line change
1
+ /// The string "PAYPALISHIRING" is written in zigzag pattern on a given number
2
+ /// of rows like this:
3
+ ///
4
+ /// P A H N
5
+ /// A P L S I I G
6
+ /// Y I R
7
+ ///
8
+ /// And then read line by line: "PAHNAPLSIIGYIR"
9
+ ///
10
+ /// Write the code that will take a string and make this conversion given a
11
+ /// number of rows:
12
+ struct Solution ;
13
+
14
+ impl Solution {
15
+
16
+ // TODO: Implement
17
+ pub fn convert ( _s : String , _num_rows : i32 ) -> String {
18
+ "" . to_string ( )
19
+ }
20
+
21
+ }
22
+
23
+ #[ cfg( test) ]
24
+ mod tests {
25
+ use super :: Solution ;
26
+
27
+ #[ ignore]
28
+ #[ test]
29
+ fn example_1 ( ) {
30
+ let s = "PAYPALISHIRING" . to_string ( ) ;
31
+ let num_rows = 3 ;
32
+ let result = Solution :: convert ( s, num_rows) ;
33
+ assert_eq ! ( result, "PAHNAPLSIIGYIR" ) ;
34
+ }
35
+
36
+ #[ ignore]
37
+ #[ test]
38
+ fn example_2 ( ) {
39
+ let s = "PAYPALISHIRING" . to_string ( ) ;
40
+ let num_rows = 4 ;
41
+ let result = Solution :: convert ( s, num_rows) ;
42
+ assert_eq ! ( result, "PINALSIGYAHRPI" ) ;
43
+ }
44
+
45
+ #[ ignore]
46
+ #[ test]
47
+ fn example_3 ( ) {
48
+ let s = "A" . to_string ( ) ;
49
+ let num_rows = 1 ;
50
+ let result = Solution :: convert ( s, num_rows) ;
51
+ assert_eq ! ( result, "A" ) ;
52
+ }
53
+
54
+ }
You can’t perform that action at this time.
0 commit comments