Satisfiability of Equality Equations
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given an array equations of strings. Each string has exactly 4 characters and is either "x==y" or "x!=y", where x and y are lowercase letters standing for single-letter integer variables (x and y may be the same letter).
Return true if it is possible to assign an integer to every variable so that all of the equations hold at the same time, and false otherwise.
Examples
Constraints
- 1 <= equations.length <= 500
- `equations[i].length == 4`
- `equations[i][0]` and `equations[i][3]` are lowercase letters
- `equations[i][1:3]` is `"=="` or `"!="`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.