Algorithm 05: Return Largest Numbers in Sub-Arrays

This algorithm introduces the notion of nested loops and comparisons. We need to loop through each item in the array, then in turn loop through the sub-array and compare if the current value is greater then the last, if so push that value to a new array ‘resultArr’ and return the new array when the loops complete.

Now that’s a mouthful.

Like to leave a comment?

Comments have been automatically closed on this post but don't let that stop you. Hit me up on following networks: