C# Solution_AC


  • 0
    Z

    C# Solution
    '''
    public class Solution {
    public int FindMaxConsecutiveOnes(int[] nums) {
    int maxCount = 0;
    int currentCount = 0;

        foreach(int num in nums)
        {
        	if(num == 1)
        	{
        		currentCount ++;
        		if(currentCount > maxCount)
        		{
        			maxCount = currentCount;
        		}
        	}
        	else
        	{
        		currentCount = 0;
        	}
        }
    
    return maxCount;
    }
    

    }
    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.