Hackerrank 30 days of code Java Solution: Day 14: Scope

The next problem is based on Scope. In our solution to this problem we have used bubble sort to calculate the maximum absolute difference. You can use any sorting technique in which you are more comfortable like quick sort, merger sort etc..


Complete the Difference class by writing the following:

  • A class constructor that takes an array of integers as a parameter and saves it to the  instance variable.
  • computeDifference method that finds the maximum absolute difference between any  numbers in  and stores it in the  instance variable.

Sample Input

Sample Output

So here  lies your Solution .

Thanks for the visit checkout the day 15 tutorial as well.. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *