Question from google online coding test goc33

Revision en2, by guptaji30, 2021-07-14 14:44:15

there are 3 types of queries

0 X add a number X _ 1 X remove the number X (X always exist)_ _ 2 X return the number of subsets that sum to X_

0<=X<=10^3 0<=number of queries <=10^3

I tried to implement this using the knapsack approach but its bound to give TLE

any suggestions? Any help would be appreciated

Tags google, # dp, interview test

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English guptaji30 2021-07-14 14:44:46 10
en2 English guptaji30 2021-07-14 14:44:15 12
en1 English guptaji30 2021-07-14 14:43:13 376 Initial revision (published)