Given an integer array
nums. Write a function int FindMaxConsecutiveOnes(int[] nums) that returns the maximum number of consecutive ones.Example 1
Input: nums = [1, 1, 0, 1]
Output: 2
Explanation: The longest consecutive sequence of ones has length 2
Output: 2
Explanation: The longest consecutive sequence of ones has length 2
Example 2
Input: nums = [0, 5, 7, 9]
Output: 0
Explanation: There are no ones in the array
Output: 0
Explanation: There are no ones in the array
Example 3
Input: nums = [1, 1, 1, 1]
Output: 4
Explanation: All array elements equal 1
Output: 4
Explanation: All array elements equal 1