Amazon Interview Question for Software Developers
- 0of 0 votes
Its farewell day, there are total N students, every student has bought a gift to give. He/She will give this gift to some other student. After gifting process is over, you are given an array, representing number of gift student receive i.e. ith number denoting number of gift he/she got. Your task is to find, whether given gift count array is valid or not. If it is valid print any of possible way of gifting that lead given array.- oaashifo April 08, 2019 in India for India
PS: Student can't gift to himself. Student has exactly one gift with himself.
Input: First line will have one integer M, denoting number of students. Next line wil have N spaced integers denoting number of gift student gets.
Ouput: -1, if given gift received array is not valid else print N spaced integers denoting ith gifted to jth.
Sample Input 1:
1 1 1
Sample Output 1:
2 3 1
| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm
Interview Type: Written Test
Open Chat in New Window