Insertion of element in an array
Submit solution
C
Points:
10 (partial)
Time limit:
8.0s
Memory limit:
64M
Author:
Problem type
Allowed languages
Problem Statement
Given an array of size N, element 'x', and position 'pos', insert the element into the array at the specified position. When the position to be inserted is given as negative, display the message "not a valid position".
Sample Input
5
1 2 3 4 5
7
3
Sample Output
1 2 7 3 4 5
Explanation
Position here indicates the position, not the index.3rd position refers to index 2.
Comments