day05 part 2 prealloc vectors
This commit is contained in:
@@ -36,7 +36,7 @@ pub fn task2() {
|
||||
fn reduce(input: &str) -> String {
|
||||
input
|
||||
.chars()
|
||||
.fold(Vec::<char>::new(), |mut stack, c| {
|
||||
.fold(Vec::<char>::with_capacity(input.len()), |mut stack, c| {
|
||||
let last: Option<char>;
|
||||
{
|
||||
if let Some(c) = stack.last() {
|
||||
|
||||
Reference in New Issue
Block a user