Since there are for loops and the inner for loop running till end of string it is actually O(N^2). Please correct me if wrong

The inner loop will run **O(n)** times as the inner loop is checking if the character already exists or not, if found it will break the loop and such traversal is done in linear time i.e **O(n)**. The outer loop is also taking **O(n**) as it will run till length of string thus total time complexity would be **O(n^2)**.