So, unfortunately my math isnt the greatest. That said, i dont understand how the solution became O(n). I understand the hashtable idea, but where did we figure out that it was O(n) instead of the other two? Is it because wikipedia gave us that formula and we just had to match what algorithm we used? If so, how do i know the name of the algorithm when i understand the code side of things but dont know the formal term?

Thanks in advance.