# lucky number

we have to input n numbers as per users choice like if n=4 we input the numbers 8,7,5,2 make the first number zero and move that many steps ahead like 8 is when made zero and we move 8 steps we move to 5(dont include 8 again)and we make 5 zero and then move 5 steps and come to 2 and then the number which has not been zero till last is the lucky number (here the answer is 7)

please provide a link to the question. It depends upon constraints. If they are small a simple brute force will work. But If they are large, then will have to think on a mathematical approach.

the question is given by school teacher and there is no link to the question

So u’re getting your homework done by us? XD hehee

Please explain your problem so that people can understand atleast what you are trying to say…I really dont get your question

the question is that we have to input n numbers (zero cant be input)in array .for example we input 4 numbers (n=4)the numbers are 8,7,5,2.we have to move 8 steps ahead whichever number is first move that many steps and make that number zero when we move 8 steps we come to 5 and make 5 equal to 0 and then move 5 steps in array then we come to 2 and then make 2 equal to zero and move 2 steps (we cant move 2 steps as all numbers are zero except one number that is 7 )so 7 is the lucky number.