In reply to rag123:
i represents each element of the queue/array not the index, you may need to use i.index
Also I’m not sure if I understand your question do you want to find all the elements of q that are present in arr irrespective of their position, or do you want to find if q[0] == arr [0] and so on.