What is the purpose of subtracting and adding contributions of those masks in which the difference in number of their set bits and the required mask is odd and even respectively. How is it helping us reach to the final answer?
Difference in the set bits of mask and required mask
At 6:40 sir used the method builtin_popcount in the if else condition.
@hardik.kharbanda99
The reason is explained starting from 17 in the explanation video SOS DP - VIM WAR HackerRank
Please see that
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.