Created
December 24, 2016 03:10
-
-
Save NaotoKumagai/880e1a83d2663f088ff114ce714c049d to your computer and use it in GitHub Desktop.
Day 14: Scope
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add your code here | |
Difference(int[] elements) { | |
this.elements = elements; | |
} | |
public void computeDifference() { | |
for(int i =0; i< elements.length; i++) { | |
for(int j=0; j < elements.length; j++) { | |
int difference = Math.abs(elements[i] - elements[j]); | |
if(difference > maximumDifference) { | |
maximumDifference = difference; | |
} | |
} | |
} | |
} | |
public int maximumDifference() { | |
return maximumDifference; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment