First thing you should consider when using recursion is the exit state; which means when the function will be exit
public static int findMin(int[] numbers, int startIndex, int endIndex) {
if(startIndex == endIndex){
return numbers[startIndex];
}
int min = findMin(numbers, startIndex+1, endIndex);
return numbers[startIndex] < min ? numbers[startIndex] : min ;
}
0
solved Recursive function without loop