Is array sorted problem in recursion

my doubt is why did you return restAns whereas we have already compare the array in upper case