474. 一和零

This commit is contained in:
li-chx
2025-11-21 11:41:21 +08:00
parent 9648737245
commit 0babcf1472
2 changed files with 46 additions and 29 deletions
+7 -1
View File
@@ -1,3 +1,9 @@
pub fn make_string_arr(s: &str) -> Vec<String> {
s.trim_matches(&['[', ']'][..])
.split(',')
.map(|s| s.trim_matches(&['"',' ']).to_string())
.collect()
}
pub fn make_arr(s: &str) -> Vec<i32> {
s.trim_matches(&['[', ']'][..])
.split(',')
@@ -72,4 +78,4 @@ pub fn make_matrix(s: &str) -> Vec<Vec<i32>> {
}
rows
}
}