Given an arrayequations of strings that represent relationships between variables, each stringequations[i] has length4and takes one of two different forms:"a==b"or"a!=b". Here,aandbare lowercase letters (not necessarily different) that represent one-letter variable names.
Returntrue if and only if it is possible to assign integers to variable names so as to satisfy all the given equations.
Example
Example 1:
Input:
["a==b","b!=a"]
Output:
false
Explanation:
If we assign say, a = 1 and b = 1,
then the first equation is satisfied, but not the second.
There is no way to assign the variables to satisfy both equations.
Example 2:
Input:
["b==a","a==b"]
Output:
true
Explanation:
We could assign a = 1 and b = 1 to satisfy both equations.