Suppose we have a string s, we have to check whether it has all unique characters or not.
So, if the input is like "world", then the output will be True
To solve this, we will follow these steps −
set_var := a new set from all characters of s
return true when size of set_var is same as size of s, otherwise false
Let us see the following implementation to get better understanding −
class Solution: def solve(self, s): set_var = set(s) return len(set_var) == len(s) ob = Solution() print(ob.solve('hello')) print(ob.solve('world'))