Recursion

AP Computer Science A· difficulty 4/5

Recursive max in array:

  • A

    Use a loop only

  • B

    Cannot recurse on arrays

  • C

    Sort first then return arr[length-1]

  • D

    max(arr, 0) = arr[0]; max(arr, n) = Math.max(arr[n-1], max(arr, n-1));

    check_circle

Explanation

Reduce: max of last element with max of rest.

Want 10 more like this — adaptive to your weak spots?

Related questions