Question: SOLVE IN JAVA Create a method: Public Static boolean isSubArray321(int[] intArray) This method has an array of integers as its input parameter, we'll say that

SOLVE IN JAVA

Create a method: Public Static boolean isSubArray321(int[] intArray)

This method has an array of integers as its input parameter, we'll say that a SubArray 321 is that three integers, 3, 2, 1, values appearing decreasing order one by one in the array. Return true if the array does contain any SubArray 321. Notice that any 3 integers that presenting a decreasing by one order must return True. (987, 876,765,654, 543, 432,321, 210 are all True)

Call this method in your main function, and pass in arrays like following:

Following are three examples

isSubArray321({1, 1, 2, 3, 2, 1}) true

isSubArray321({1, 1, 3, 2, 3, 2, 2}) false

isSubArray321({1, 2, 3, 4, 3, 2, 2, 1}) true

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!