Tap here to switch tabs
Problem
Submissions

Problem: Check for Contradictions in Equations

Check for Contradictions in Equations gives variable pairs and real-number ratios, then asks whether those equations are mutually consistent. Return true if any relationship conflicts with others.

Statement

You are given a 22D array of string pairs equations and an array of real numbers values, where equations[i] = [A_i, B_i] and values[i] represent the equation A_i // B_i == values[i].

Return true if there is a contradiction in the given equations, or false otherwise.

Constraints:

  • 1≤1 \leq equations.length ≤100\leq 100

  • equations[i].length =2= 2

  • 1≤1 \leq A_i.length, B_i.length ≤5\leq 5

  • A_i and B_i consist of lowercase English letters.

  • equations.length == values.length

  • 0.0<0.0 < values[i] ≤10.0\leq 10.0

  • values[i] has a maximum of 22 decimal places.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check for Contradictions in Equations

Check for Contradictions in Equations gives variable pairs and real-number ratios, then asks whether those equations are mutually consistent. Return true if any relationship conflicts with others.

Statement

You are given a 22D array of string pairs equations and an array of real numbers values, where equations[i] = [A_i, B_i] and values[i] represent the equation A_i // B_i == values[i].

Return true if there is a contradiction in the given equations, or false otherwise.

Constraints:

  • 1≤1 \leq equations.length ≤100\leq 100

  • equations[i].length =2= 2

  • 1≤1 \leq A_i.length, B_i.length ≤5\leq 5

  • A_i and B_i consist of lowercase English letters.

  • equations.length == values.length

  • 0.0<0.0 < values[i] ≤10.0\leq 10.0

  • values[i] has a maximum of 22 decimal places.