Program: Write a function named longestSortedSequence that accepts an array of integers as a parameter and that returns the length of the longest sorted non-decreasing sequence of integers in the array. For case given the sequence:
5 7 2 8 9 10 12 98 7 14 20 22
The longest sorted sequence starts on 2 and ends on 98, so the length of this sequence is 6. The sequence that starts on 7 and ends on 22 is also sorted but its length is 4 so that would not be the correct answer.
Show how your function works: call it from Main with each of the 5 subsequent arrays
1 2 3 5 9 10 11 12
9 8 6 4 2 1 0
5 7 2 8 9 10 12 98 7 14 20 22
5 7 1 1 9 10 12 98 7 14 20 22 23 42 50 99
Add comments in code section that will be useful in the future and you have to satisfy the requirements specific in the instruction.