Class Solution
java.lang.Object
g1201_1300.s1237_find_positive_integer_solution_for_a_given_equation.Solution
1237 - Find Positive Integer Solution for a Given Equation.<p>Medium</p>
<p>Given a callable function <code>f(x, y)</code> <strong>with a hidden formula</strong> and a value <code>z</code>, reverse engineer the formula and return <em>all positive integer pairs</em> <code>x</code> <em>and</em> <code>y</code> <em>where</em> <code>f(x,y) == z</code>. You may return the pairs in any order.</p>
<p>While the exact formula is hidden, the function is monotonically increasing, i.e.:</p>
<ul>
<li><code>f(x, y) < f(x + 1, y)</code></li>
<li><code>f(x, y) < f(x, y + 1)</code></li>
</ul>
<p>The function interface is defined like this:</p>
<p>interface CustomFunction { public: // Returns some positive integer f(x, y) for two positive integers x and y based on a formula. int f(int x, int y); };</p>
<p>We will judge your solution as follows:</p>
<ul>
<li>The judge has a list of <code>9</code> hidden implementations of <code>CustomFunction</code>, along with a way to generate an <strong>answer key</strong> of all valid pairs for a specific <code>z</code>.</li>
<li>The judge will receive two inputs: a <code>function_id</code> (to determine which implementation to test your code with), and the target <code>z</code>.</li>
<li>The judge will call your <code>findSolution</code> and compare your results with the <strong>answer key</strong>.</li>
<li>If your results match the <strong>answer key</strong> , your solution will be `</li>
</ul>
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
findSolution
-