diff --git a/10 Days of Statistics/Day 8 - Pearson Correlation Coefficient II/Solution.txt b/10 Days of Statistics/Day 8 - Pearson Correlation Coefficient II/Solution.txt index 3c97c9a..93cb9c3 100644 --- a/10 Days of Statistics/Day 8 - Pearson Correlation Coefficient II/Solution.txt +++ b/10 Days of Statistics/Day 8 - Pearson Correlation Coefficient II/Solution.txt @@ -34,5 +34,5 @@ p = 3/4 or -3/4 (depending on correlation of x and y) *** Step 3: Find out if p is postive or negative *** -We simply plot 2 sets of (x,y) points to see if x and y are positively or negatively correlated. -In this case, they are negatively correlated, so p = -3/4 +Notice that both of the original line equations have negative slopes, +so x and y are negatively correlated by definition. So, p = -3/4 diff --git a/Java/Data Structures/Java 1D Array (Part 2)/Solution.java b/Java/Data Structures/Java 1D Array (Part 2)/Solution.java index e88780b..a1a35a8 100644 --- a/Java/Data Structures/Java 1D Array (Part 2)/Solution.java +++ b/Java/Data Structures/Java 1D Array (Part 2)/Solution.java @@ -22,7 +22,7 @@ public class Solution { /* Basically a depth-first search (DFS). Marks each array value as 1 when visiting (Side-effect: alters array) */ - private static boolean isSolvable(int [] array, int m, int i) { + private static boolean isSolvable(int[] array, int m, int i) { /* Base Cases */ if (i < 0 || array[i] == 1) { return false; @@ -32,9 +32,9 @@ public class Solution { array[i] = 1; // marks as visited - /* Recursive Cases */ - return isSolvable(array, m, i - 1) || + /* Recursive Cases (Tries +m first to try to finish game quickly) */ + return isSolvable(array, m, i + m) || isSolvable(array, m, i + 1) || - isSolvable(array, m, i + m); + isSolvable(array, m, i - 1); } }