diff options
| -rw-r--r-- | 05_longest-palindromic-substring/Cargo.toml | 6 | ||||
| -rw-r--r-- | 05_longest-palindromic-substring/src/main.rs | 3 | ||||
| -rwxr-xr-x | init.nu | 12 |
3 files changed, 15 insertions, 6 deletions
diff --git a/05_longest-palindromic-substring/Cargo.toml b/05_longest-palindromic-substring/Cargo.toml new file mode 100644 index 0000000..0b94a20 --- /dev/null +++ b/05_longest-palindromic-substring/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "longest-palindromic-substring" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/05_longest-palindromic-substring/src/main.rs b/05_longest-palindromic-substring/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/05_longest-palindromic-substring/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} @@ -5,11 +5,9 @@ def main [ name: string idx?: int ] { let idx = if ($idx | is-empty) { ( glob "*_*" - | split row '/' - | get (($in | length) - 1) - | split row '_' - | get 0 - | into int + | each {|l| $l | split row '/' | last | split row '_' | first | into int } + | sort + | last | $in + 1 | (if $in < 10 { $"0($in)" } else { $in } ) ) @@ -31,7 +29,9 @@ def main [ name: string idx?: int ] { cargo new $problem_name --name $name --vcs none if $env.LAST_EXIT_CODE == 0 { - rm -r $tmp_dir + if ($existing | is-not-empty) { + rm -r $tmp_dir + } } else { mv $tmp_dir $problem_name } |
