https://www.hackerearth.com/practice/algorithms/dynamic-programming/bit-masking/practice-problems/algorithm/the-three-musketeers/

this question makes use of bitmasking … i was unable to understand the editorial … please guide me how to proceed as i don’t have much of any experience in bitmasking questions . Thanks.

P.S. :- also suggest some nice questions on dp+bitmasking to start with as i have encountered problems which are pity tough for me start with .

2 Likes

yes … i got that you are doing bitwise OR to keep the count of number of vowels … but afterwards

for(it=mp.begin();it!=mp.end();it++)

if(((it->first)&i)==i)

term+=it->second;

i couldn’t understand this .

also , how are you keeping track of , picking the three strings such that one or more than one vowels are common in them

1 Like