You are required to implement a function that identifies the indices of elements in an array where the element's value is equal to its index + 1. Specifically, you need to create a Python function named valueEqualToIndex that fulfills the following criteria:
Functionality: The function should take an array arr of integers and its length n, and return a list of integers. Each integer in the returned list should represent the index (1-based) where the condition arr[i] == i + 1 holds true.
Input Requirements:
The function will receive an integer array arr of length n (where 1 <= n <= 1000).
The array may contain positive integers, and the range is not specified but can be assumed to be within reasonable limits for indices.
Output Requirements:
The function should return a list of integers.
If no elements match the criteria, an empty list should be returned.
Implementation
You need to implement the valueEqualToIndex function in a file named /app/solution.py. The function signature must be exactly as follows:
python
def valueEqualToIndex(arr, n):
...
Here is an example of how the function should work: