• + 1 comment

    So, I've been staring at this problem for about an hour now. Trying to break it down into steps.

    I get what it's doing, taking the input, building out the 2 arrays that's essentially creating the matrix.

    Then, putting values into those array slots with a for loop using the iterator (a_i and b_i) to move through the array, but not create an array longer than whats needed.

    Then, taking the input for r1, c1, r2, c2 to specify a submatrix.

    I also found information on how to calculate GCD in Java using Euclid’s method seen here: http://www.java67.com/2012/08/java-program-to-find-gcd-of-two-numbers.html

    What I haven't been able to figure out, is how to get get Java to look at each position within the submatrix (after calculating GCD) and count how many unique numbers exist within.

    I started the 30 days of code to get some practice with Java, I'm self-taught so far and have never programmed professionally. How do you go from a "Hello World" program in my 1st challenge, to this in the 2nd challenge?

    Can anyone shed some light on this or maybe direct me to a more beginner friendly challenge series?