The only two condition you need is to check is whether the number is palindrome or not(if not print -1) and the second condition is that it should contain 7 as its mid element(Your array can have more than one 7 in it).
You can view my solution for further queries - CodeChef: Practical coding for everyone
thanks for quick response . in the problem it says
First a1 elements equal 1.
Next a2 elements equal 2.
Next a3 elements equal 3.
Next a4 elements equal 4.
Next a5 elements equal 5.
Next a6 elements equal 6.
Next a7 elements equal 7.
Next a6 elements equal 6.
Next a5 elements equal 5.
Next a4 elements equal 4.
Next a3 elements equal 3.
Next a2 elements equal 2.
Next a1 elements equal 1
then in constraints it says
1 >= Ai <= 10
if array goes to 7 then why 10 in constraints ???
It means that every element of array is less than 10, size of array can be as large as 50. We can prove that there is no rainbow array of size<=10, you need atleast 13 elements