This is a verified interview question from Goldman-sachs. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Equal Array Sum - IIT Roorkee Guwahati Goldman Sachs Online Assessment Quant Role" covers key patterns like Other.
"### Problem You are given two integer arrays A and B of lengths N and M, respectively. Some elements of the arrays are equal to 0. You may replace every 0 with any positive integer. Determine the minimum possible value S such that, after replacing all zeros, both arrays have the same total sum S. If it is impossible, print -1. ### Input N M A1 A2 ... AN B1 B2 ... BM ### Output Print the minimum equal sum, or -1 if no valid assignment exists."
Join thousands of developers practicing for Goldman-sachs.