Package g0701_0800.s0780_reaching_points
Class Solution
java.lang.Object
g0701_0800.s0780_reaching_points.Solution
780 - Reaching Points.<p>Hard</p>
<p>Given four integers <code>sx</code>, <code>sy</code>, <code>tx</code>, and <code>ty</code>, return <code>true</code> <em>if it is possible to convert the point</em> <code>(sx, sy)</code> <em>to the point</em> <code>(tx, ty)</code> <em>through some operations</em>_, or_ <code>false</code> <em>otherwise</em>.</p>
<p>The allowed operation on some point <code>(x, y)</code> is to convert it to either <code>(x, x + y)</code> or <code>(x + y, y)</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> sx = 1, sy = 1, tx = 3, ty = 5</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong></p>
<pre><code> One series of moves that transforms the starting point to the target is:
(1, 1) -> (1, 2)
(1, 2) -> (3, 2)
(3, 2) -> (3, 5)
</code></pre>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> sx = 1, sy = 1, tx = 2, ty = 2</p>
<p><strong>Output:</strong> false</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> sx = 1, sy = 1, tx = 1, ty = 1</p>
<p><strong>Output:</strong> true</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= sx, sy, tx, ty <= 10<sup>9</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
reachingPoints
public boolean reachingPoints(int sx, int sy, int tx, int ty)
-