Implement the isArraySortedAscending method that checks whether the array is sorted in ascending order.
The input contains an integer array nums and its length size. Your task is to check whether the array is sorted in ascending order.
Ascending order means each element must be less than or equal to the element after it. Equal neighboring values are allowed. For example, [1,2,2,4] is sorted, but [1,3,2] is not.
Compare every element with the element before it.
If any current value is smaller than the previous value, the array is not sorted in ascending order and you can return false. If the loop completes, return true.
Pseudocode:
function isArraySortedAscending(nums, size):
for i from 1 to size - 1:
if nums[i] < nums[i - 1]:
return false
return true