You are viewing a single comment's thread. Return to all comments →
Seems like we missunderstood each other. I was talking about time complexity the whole time. As for the space complexity yes it is O(n), O(1) is not possible in this problem since we have to store the elements.
hi bro,i am a beginner.How to understand these concepts of time complexity and space complexity.
You should not worry about these things if you are a beginner,but since you have asked i have explained it here, take a look.
In the beginning your focus should be to complete the task without worrying about these time/space complexities.
My pleasure :)