# What is the time complexity of adding three matrices of size NXN cell-by-cell ?

What is the time complexity of adding three matrices of size NXN cell-by-cell ?

A. O(N)

B. O(N^{2})

C. O(N^{3})

D. None of these

**Answer : **B. O(N^{2})

## Explanation :

- Time complexity will be O(n
^{2}), because if we add all the elements one by one to other matrics we have to traverse the whole matrix at least 1 time and traversion takes O(n^{2}) times. - With this traversion we add 3 elements of location [ i, j ] and storing the result on other matrix at [ i, j ] location.