AND Reachability WA

I am getting WA, for the code: https://ide.codingblocks.com/s/374546.
Please help me to understand what’s wrong with my approach.

Hey @Realnam332
Please explain ur approach :slight_smile:

For each element in the array I am finding the minimum distance required to sit its bits, this is stored in dp matrix.
I’ve taken a bit[j][k] matrix which represent distance to set jTh bit using kTh bit, so I’ve stored the distance of element where the jTh bit and kTh bit are both set.
I’ve added comments to the code.