Read an array and a target value, and print the index of the target (or -1 if it's not found).
Input / Output
Input: first line N, second line N space-separated integers, third line the target value. Output: the 0-based index of target, or -1 if not present.
Examples
Input
5 4 2 7 1 9 7
Expected Output
2
Input
3 10 20 30 25
Expected Output
-1
+ 2 hidden tests checked on Submit.
Main.java is the entry point. Add extra classes for OOP exercises — they compile together.
Run your code to see test results here.