You are given an array arr[] of integers. Your task is to check whether the array is sorted in non-decreasing order using recursion only. You are not allowed to use any loops.
Example 1
Input: arr[] = [10 20 30 40 50 60]
Output : true Explanation: The Array Is Sorted
Example 2
Input: arr[] = [ 90 80 60 70 40 100]
Output: false
Explanation: The Given Array is Not Sorted
Approach, complexity and clean code in every language. Sign in to unlock the editorial.
Your submissions, results and runtime history live here. Sign in to start your streak.
1 2 3 4 5
Sorted