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.
I don't see how the editorial or solutions people are presenting account for the disjoint property?
In sample 1 we have
357115857111058
which, if we sort, we can see;
355781155781011
You can see sets of 5, 6, 8, and 11. This is 4 sets. Is we allow non-disjoint sets, we have 2 copies of the set of 5.
So, with disjoint pairs we have 4 right now, non-disjoint we have 5.
If we make 1 change we can change a 5 to a 3, or the 10 to a 3 to add 1 more set.
If we change the 10, and we only count disjoint pairs we now have 5, but if we count the non-disjoint pairs of 5, we have 6 now.
The answer shown is 6. So, the problem instructions/explanation seem in error?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Pairs
You are viewing a single comment's thread. Return to all comments →
I don't see how the editorial or solutions people are presenting account for the disjoint property?
In sample 1 we have
which, if we sort, we can see;
You can see sets of 5, 6, 8, and 11. This is 4 sets. Is we allow non-disjoint sets, we have 2 copies of the set of 5. So, with disjoint pairs we have 4 right now, non-disjoint we have 5. If we make 1 change we can change a 5 to a 3, or the 10 to a 3 to add 1 more set. If we change the 10, and we only count disjoint pairs we now have 5, but if we count the non-disjoint pairs of 5, we have 6 now.
The answer shown is 6. So, the problem instructions/explanation seem in error?