diff --git a/src/Problems/Problem18.rs b/src/Problems/Problem18.rs index 549967a..4fad3c2 100644 --- a/src/Problems/Problem18.rs +++ b/src/Problems/Problem18.rs @@ -73,17 +73,19 @@ impl PartialEq for Location{ pub fn solve() -> Answer{ let NUM_ROWS = 15; - //Start the timer - let mut timer = myClasses::Stopwatch::Stopwatch::new(); - timer.start(); - //Setup the list you are trying to find a path through + //Reserve space for the list let mut list = Vec::>::new(); for _ in 0..NUM_ROWS{ list.push(Vec::::new()); } + //Setup the list setupList(&mut list); + //Start the timer + let mut timer = myClasses::Stopwatch::Stopwatch::new(); + timer.start(); + //Invert the list invert(&mut list); @@ -128,6 +130,9 @@ pub fn solve() -> Answer{ } } + //Invert the list again so you get the correct list + invert(&mut list); + //Stop the timer timer.stop(); diff --git a/src/Problems/Problem67.rs b/src/Problems/Problem67.rs index dc20bba..c2fb6e1 100644 --- a/src/Problems/Problem67.rs +++ b/src/Problems/Problem67.rs @@ -158,17 +158,18 @@ impl PartialEq for Location{ pub fn solve() -> Answer{ let NUM_ROWS = 100; - //Start the timer - let mut timer = myClasses::Stopwatch::Stopwatch::new(); - timer.start(); - //Setup the list you are trying to find a path through + //Reserve space for the list let mut list = Vec::>::new(); for _ in 0..NUM_ROWS{ list.push(Vec::::new()); } setupList(&mut list); + //Start the timer + let mut timer = myClasses::Stopwatch::Stopwatch::new(); + timer.start(); + //Invert the list invert(&mut list); @@ -213,6 +214,9 @@ pub fn solve() -> Answer{ } } + //Invert the list again so you get the correct list + invert(&mut list); + //Stop the timer timer.stop();