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