Evaluate query ratios from equations | Instacart Interview Question