Why is the complexity O(N^2) and not O(N)
sparshgarg23 opened this issue · comments
sparshgarg23 commented
Hello,can you explain why the compexity is O(N^2) and not O(N)
kamyu commented
I don't understand which problem you are asking about.
Could you give me more details?
sparshgarg23 commented
Sure I will get back to you soon with the details
sparshgarg23 commented
The problem is reverse substrings between each pair of parantheses(C++ )
kamyu commented
About "1190. Reverse Substrings Between Each Pair of Parentheses" :
- I added a real O(n) solution from Leetcode forum.
- In the 2-pass solution, each character is traversed only once in each pass, so it is O(n).
- Thanks for your friendly reminder.