Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Publishing With Filemaker Pro On The Web

Authors: Maria Langer

1st Edition

0201696657, 978-0201696653

More Books

Students also viewed these Databases questions

Question

=+ How well do you think you could do your job?

Answered: 1 week ago