What is the best solution for this?

Правка en1, от pH7, 2020-08-14 09:38:31

You are given two N size arrays A and B. Then you will have to answer Q queries : Given X -> If A[i] | B[j] = X for some i, j < N, print 1, else 0.

1 <= N, Q <= 100000 0 <= A[i], B[i] <= 100000

I tried to solve using trie, but i could not determine overall complexity. Can someone please help me solving this best possible way?

Note : This problem is not from any running contest.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский pH7 2020-08-14 09:38:31 455 Initial revision (published)