The program must accept N integers and print the integers which are equal to their index value as the output. If there is no such integer, the program must print -1 as the output.
Input :
6
5 4 2 3 6 5
Output :
2 3 5
Explanation:
Here 2, 3 and 5 are the integers equal to their index value.
Here are the various methods and logic.
C++

Python :
#Python code by Agent Cherry
C :




Leave a Reply