You are viewing a single comment's thread. Return to all comments →
Here's mine :)
N = int(input())
strArray = 
for _ in range(N):
Q = int(input())
for _ in range(Q):
query = input()
print(strArray.count(query)) #count how many times query occured in strArray
Much worse than hashmap-based solutions because you do linear search, so O(NQ). Hashmap-based solution is constant time complexity for queries, so O(N).
What is the use of underscore in for loop?
It is the way you name variable which will not be used, so it is in accordance with PEP8 style guide.