Sir, how could we approach this problem in DP manner. I solved it using modular exponentiation and divide&conquer method from the mentioned hint?
Regarding DP(Bali Pairs)
1 Like
It is like Knapsack Problem.
If you see at every pairs you have two choices that either to left shoe or right. So take both the possibilities and call recursion for remaining shoes respectively.
And the end see the sum as odd then this combination is counted otherwise not.
@pangatt4 You can please have a look at this code of mine, i have commented it properly. See this and ask if any doubt exists. https://ide.codingblocks.com/s/237882
1 Like