I am trying to solve this problem on Hackerearth : https://www.hackerearth.com/practice/algorithms/dynamic-programming/bit-masking/practice-problems/algorithm/when-the-integers-got-upset/description/
I made a solution using 3-D DP + Bitmasking, but getting an error
My solution : http://ideone.com/PnCP9i
Can someone please help me?