This question has to be solved in what time complexity . it says time limit eexce


#1

this question has to be solved in what time complexity . it says time limit eexceeded for me


#2

O(n) time complexity