780. Reaching Points Hard
1/**
2 * [780] Reaching Points
3 *
4 * Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, ty) through some operations, or false otherwise.
5 * The allowed operation on some point (x, y) is to convert it to either (x, x + y) or (x + y, y).
6 *
7 * Example 1:
8 *
9 * Input: sx = 1, sy = 1, tx = 3, ty = 5
10 * Output: true
11 * Explanation:
12 * One series of moves that transforms the starting point to the target is:
13 * (1, 1) -> (1, 2)
14 * (1, 2) -> (3, 2)
15 * (3, 2) -> (3, 5)
16 *
17 * Example 2:
18 *
19 * Input: sx = 1, sy = 1, tx = 2, ty = 2
20 * Output: false
21 *
22 * Example 3:
23 *
24 * Input: sx = 1, sy = 1, tx = 1, ty = 1
25 * Output: true
26 *
27 *
28 * Constraints:
29 *
30 * 1 <= sx, sy, tx, ty <= 10^9
31 *
32 */
33pub struct Solution {}
34
35// problem: https://leetcode.com/problems/reaching-points/
36// discuss: https://leetcode.com/problems/reaching-points/discuss/?currentPage=1&orderBy=most_votes&query=
37
38// submission codes start here
39
40impl Solution {
41 pub fn reaching_points(sx: i32, sy: i32, tx: i32, ty: i32) -> bool {
42 false
43 }
44}
45
46// submission codes end
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51
52 #[test]
53 fn test_780() {
54 }
55}
56
Back
© 2025 bowen.ge All Rights Reserved.