How can i improve this code wrt time complexity?

@Narasimha for each query check if the hashmap contains the element then we will print Yes otherwise print No. The checking of element from the hashmap will be done in O(1) so for answering Q queries time complexity required will be O(Q)
refer to this code:

please mark your doubt as resolved if u are satisfied with the solution :slight_smile: