Question: 3: Longest Streak Again [10 marks] In the provided Problem3.java file, complete the method called longestStreak. There should be no other methods or attributes in

 3: Longest Streak Again [10 marks] In the provided Problem3.java file,

3: Longest Streak Again [10 marks] In the provided Problem3.java file, complete the method called longestStreak. There should be no other methods or attributes in your class. The contract (specification) of the method is given below public static int[] longestStreak (boolean [] values) /*Purposecomputes the length and locations of all the maximal sequences of consecutive true occurrences in values * Inputs : values is a non-null array of booleans with length at least 1 * * Outputs : outputs an integer array with one or more elements first element is the length of a maximal sequence oif consecutive trues in the input array values - the next elements are the indexes of the starting points* (in the input array values) of each of the maximal sequences of consecutive trues (in increasing order) if there are no true values in the input array, output [01 x/ Do not change the method signature (use the provided skeleton java file). Changing the method modifiers, return type, name or input arguments will result in zero correctness marks for this problem. Mark breakdown: 2 for style, 8 for correctness Put your Problem3.java file in your assignmenti.zip file Examples: Using the same examples as Problem 2, the output would be (in the same order) [2,1],[0][1,0,2] and [3,1,5] . Other examples include boolean [] test.case [true, false, true, false, true Problem3.longestStreak test case) test-case = new boolean []{false, false, false, true, true); Problem3.longestStreak test case) returns returns [2,3]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!