Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up

Check Array is Sorted

Basic Acceptance 80.00% Points 10.00

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.

Examples
Example 1

Example 1

Input: arr[] = [10 20 30 40 50 60]

Output : true Explanation: The Array Is Sorted

Example 2

Example 2

Input: arr[] = [ 90 80 60 70 40 100]

Output: false

Explanation: The Given Array is Not Sorted

Hints
Hint 1
N/A
Constraints
  • 1 < n < 105
  • -109 < arr[i] < 109
Companies
Apple Samsung BNY Mellon
Topics
Recursion
Solution.cs C#JavaPythonC++Javascript

Unlock the code editor

Sign in to write, run, and submit your solution against the full test suite.

  • Run code against sample & hidden test cases
  • Save submissions and track your streak
  • Compare with editorial & community solutions