Problem 46 of 75

Evaluate Division

MediumNot solved yetInterview me on this
Before you code · which pattern fits?

The problem

You are given equations like a / b = 2.0 as pairs [a, b] with values, and queries [c, d]. Return the answer for each query, or -1.0 if it cannot be determined.

equations [["a","b"],["b","c"]], values [2,3], query a/c → 6.0

Your solution runs against 1 unit tests, including edge and large-value cases.

Loading...

Test console · 1 unit tests

Submit your code to run it against all 1 unit tests. Results appear here.

JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.

Hint

Reference solution

Video explanation

Evaluate Division, explainedNeetCodeIO