Back to course home
0% completed
Vote For New Content
Solution: Satisfiability of Equality Equation
Problem Statement
You are given an array of strings called equations. Each string in this array represents a relationship between two variables and follows one of two formats: "a==b" or "a!=b". Here, a and b are lowercase letters.
Return true if it is possible to assign values to these variables such that all the given relationships are satisfied. Otherwise, return false.
Examples
Example 1:
- Input: equations =
["a==b", "b==c", "a==c", "d == b"] - Output:
true - Explanation: All variables can be assigned the same value, satisfying all equations.
.....
.....
.....
Like the course? Get enrolled and start learning!