'can anyone tell me what is the time complexity of the code below:

I am trying to find an index value in 2D array and I don't know about time complexity of this code

for i in matrix:
    if target in i: print("yes")


Solution 1:[1]

O(nm) ; n x m is the dimension of the matrix

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aniket Kumar Paul