It’ll return zero because the base case, the number it is in the array large when you initialise it is a zero.
In your conditional statement you’re checking to see if are[I][j] is greater than what is already in large
So, the code is testing each element in this array [-72, -3, -17, -10] to see if it is greater than zero and if it is it is returning the number. Otherwise it keeps the original 0 in your large array.
As the numbers are minus it keeps the 0 as the conditionals statement each case if false.
To get round this you could do something like:
Set large to an empty array.
Create a variable e.g. biggestNum in the first [i] loop with the initial value of the individual arrays e.g. arr[I]
Then in the second loop you compare each value to that variable and if they are bigger than biggestNum
If so biggestNum is replaced with a new value i.e. the new element.
Else nothing bigger is found and biggestNum is the biggest number.
Then when each round of the second (j) loop is completed you push the biggest num to large
I hope that’s all clear. I tried to share a solution with a walk through but it’s automatically removed but the mod.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.