educative.io

How the solution is O(1)?

How the solution is O(1) ?

hi @SUSHANTA_MUKHERJEE

I am unable to find the lesson for which you asked the question. Could you please provide me with the direct link to that lesson so I can look into it?
thanks!

Hi @SUSHANTA_MUKHERJEE
The O(1) time complexity is for functions related to the HashSet (set function) and Linked List (deletion at head).
The overall time complexity for the algorithm is O(n). Hope this helps!