diff options
| author | m4siri <git@m4siri.com> | 2025-12-01 17:16:26 +0545 |
|---|---|---|
| committer | m4siri <git@m4siri.com> | 2025-12-01 17:26:26 +0545 |
| commit | 224bf52811c230567a47cb4badbbe20a3afd2f41 (patch) | |
| tree | 862eb4310f4ece75a428679c1f4e785ea9be1114 | |
| parent | c980379392545eeef99c17205cba71b8e382c487 (diff) | |
fix: init script
| -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 } |
