Array is array miror inverse

https://hack.codingblocks.com/contests/c/509/204
https://ide.codingblocks.com/#/s/30872
test case failed

https://ide.codingblocks.com/#/s/30877

your logic is wrong. You are making the number which wont be possible if N is large. if N is 100, then 10^100 wont be computed corrected and definately give wrong answer.
I have corrected a small mistake but still the logic is not correct.

1 Like

HINT: Think in terms of functions used in maths.
F(0)=0, F(1)=4 F(2)=1 F(3)=2 F(4)=3.
Its inverse will be
G(0)=0, G(4)=1, G(1)=2, G(2)=3, G(3)=4.

Now compare the inverse and the original function.

1 Like

but mirror inverse problem is same as this problem and i got full score in mirror inverse problem applying same logic

Constraints. Here N is huge. In that problems constraints may be small i suppose.

1 Like