1. Engineering
  2. Computer Science
  3. n ihe provided findjava fieoeie the locatesequeneho for a iven...

Question: n ihe provided findjava fieoeie the locatesequeneho for a iven...

Question details

n ihe provided Find.java fie,oeie the locateSequeneho For a iven taarei (non-empty array of integers), the method searches the input array (of integers) to find an occur- rence of the target sequence if it is present. If the sequence is present, the method returns the array index position of where it starts in the array. If the sequence is not present, the method returns-1. Consider the following array: 867 53 09 If we look for the sequence 7,5,3 in this array, the method should return 2. If we look for the sequence 9, it should return 6, and if we look for the sequence 3,0,9,1, it should return -1. If the sequence appears in the array more than once, the returned position should correspond to the last occurrence of the sequence.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution