Question: Write the Java method below that takes two integer arrays a and b and returns true only if the values in a appear consecutively in
Write the Java method below that takes two integer arrays a and b and returns true only if the values in a appear consecutively in b. You may assume all values in a are distinct. However, the values in b may or may not include duplicates. Here are several sample inputs and return values:
| Argument Array a | Argument Array b | Return Value |
| 55 33 22 | 7 6 55 33 22 1 | true |
| 5 3 2 | 5 66 44 3 2 11 | false |
| 88 17 9 50 | 77 88 17 9 50 11 4 -3 | true |
| 5 3 2 | 5 3 3 3 2 | false |
| 50 49 48 60 53 | 50 49 48 60 | false |
---------------------------------------------------------------------------------------------
public static boolean appearsConsecutively(int [] a, int [] b) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
