rules; each rule is a four-character string of one of two kinds:
- "a==b": variables a and b are equal;
- "a!=b": variables a and b are different.
The two letters in a rule may be the same.
Return True if integers can be assigned to the variables so that all rules hold at once, otherwise False.rules=["p==q", "q==r", "r!=p"] → False
The first two rules force p, q and r to be equal, so r != p cannot hold.
rules=["x!=y", "y==z", "x==x"] → True
For example x = 1, y = z = 2 satisfies every rule.
rules=["k!=k"] → False
rules[i][0] and rules[i][3] are lowercase English lettersrules[i][1:3] is either "==" or "!="rules=["p==q", "q==r", "r!=p"]
False
Run checks the first 3 tests in your browser. Submit checks all 85 tests on the server, hidden ones included.