Intuition
We use set to check if the sentence given has all the alphabet.
We are using set arithmetic, namely difference
→ set(A) - set(B)
will create a set of all elements in A but not in B. So naturally, set A must be greater than B.
If you are interested in learning more about set arithmetic, look into set union
, set intersection
and set difference
. Check out this link
Code
Python3
Big O Analysis
-
Runtime
The runtime complexity here is since we are converting the sentence of length N into a set. If N < 26, then it’s O(26) cuz of the
string.ascii_lowercase)
. -
Memory
The memory usage is since we are in-fact using sets.
— A