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.
# Complete the freqQuery function below.deffreqQuery(queries):freq_count={}output=[]forqinqueries:command=q[0]value=q[1]ifcommand==1:#insertifvaluenotinfreq_count.keys():freq_count[value]=1else:freq_count[value]+=1ifcommand==2:#removeifvalueinfreq_count.keys():iffreq_count[value]>0:freq_count[value]-=1ifcommand==3:#checkfreqhas_freq=0ifvalueinfreq_count.values():has_freq=1output.append(has_freq)returnoutput
Frequency Queries
You are viewing a single comment's thread. Return to all comments →
My Python code: