Question: JAVASCRIPT Problem Statement: Given an array representing a sequence in the forest, identify the maximum number of consecutive 'rabbit' elements without any intervening 'rock' elements.
JAVASCRIPT
Problem Statement:
Given an array representing a sequence in the forest, identify the maximum number of consecutive 'rabbit' elements without any intervening 'rock' elements.
Input Format:
An array forest where each element is either 'rabbit' or 'rock'.
Output Format:
An integer representing the length of the longest continuous sequence of 'rabbit'.
Examples:
Example :
Input: forest rabbit 'rabbit', 'rock', 'rabbit', 'rabbit', 'rabbit'
Output:
Example :
Input: forest rabbit 'rock', 'rabbit', 'rabbit', 'rock', 'rabbit'
Output:
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
