Question: is _ sorted ( arr: StaticArray ) - > int: Write a function that receives a StaticArray and returns an integer that describes whether the
issortedarr: StaticArray int:
Write a function that receives a StaticArray and returns an integer that describes whether
the array is sorted. The method must return:
if the array is sorted in strictly ascending order.
if the list is sorted in strictly descending order.
otherwise.
Arrays consisting of a single element are considered sorted in strictly ascending order.
You may assume that the input array will contain one or more homogeneous elements
either all numbers, or strings, or custom objects, but never a mix of these You do not
need to write checks for these conditions.
The original array must not be modified.
For full credit, the function must be implemented with ON complexity, with no additional
data structures including Static Arrays being created.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
