Write a program that reads two sequences of numbers and outputs the starting positions of the first and the last occurrences of the second sequence within the first one, or -1 if there is no such occurrence. Numbers must be separated by a space.
The utility class Collections
The first index of a sublist
Report a typo
Sample Input 1:
2 1 2 3 4 1 2 3
1 2 3Sample Output 1:
1 5Sample Input 2:
77 2 4 112 3
104Sample Output 2:
-1 -1Sample Input 3:
1
1Sample Output 3:
0 0Write a program in Java 17
class Main {
public static void main(String[] args) {
// put your code here
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.