Question: 1. How do you return the highest value in an array and return 0 if it is an empty array without using inbuilt libraries and

1. How do you return the highest value in an array and return 0 if it is an empty array without using inbuilt libraries and hardcoding.

For example: {{60,70,80}{10,20,30}{50,60,10)} the answer should be 80

public int max () {

return 0;

}

2. How do you return the maximum value in sub-array at index and return 0 if index is invalid or empty without using inbuilt libraries and hardcoding

For example: {{60,70,80}{10,20,30}{50,60,10)} the answer should be 80, 30, 60

public int max(int idx){

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!