We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Can anyone explain the implementation of 'Inclusion–exclusion principle' from Editorial ?
The author says that he is targeting the value within the intersection of sets, i.e. |A^B^C|, but, from the code I see the unioun of sets, i.e.
|A| + |B|+ |C| - |A ^ B| - |A ^ C| - |B ^ C| + |A ^ B ^ C| = |A v B v C|
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Candles Counting
You are viewing a single comment's thread. Return to all comments →
Can anyone explain the implementation of 'Inclusion–exclusion principle' from Editorial ? The author says that he is targeting the value within the intersection of sets, i.e. |A^B^C|, but, from the code I see the unioun of sets, i.e. |A| + |B|+ |C| - |A ^ B| - |A ^ C| - |B ^ C| + |A ^ B ^ C| = |A v B v C|