Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Jan 5, 2025
1 parent 4f90f1f commit 6af3b17
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rust/series/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ pub fn series(digits: &str, len: usize) -> Vec<String> {
return vec![];
}

let windows: Vec<&str> = (0..=digits.len() - len)
.map(|i| &digits[i..i + len])
.collect();
windows.iter().map(|&s| s.to_string()).collect()
(0..=digits.len() - len)
.map(|i| &digits[i..i + len])
.collect::<Vec<&str>>()
.iter()
.map(|&s| s.to_string())
.collect()
}

0 comments on commit 6af3b17

Please sign in to comment.