CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes572downloads
1{2    "id": 2635,3    "name": "check_if_point_is_reachable",4    "difficulty": "Hard",5    "link": "https://leetcode.com/problems/check-if-point-is-reachable/",6    "date": "2023-01-07 00:00:00",7    "task_description": "There exists an infinitely large grid. You are currently at point `(1, 1)`, and you need to reach the point `(targetX, targetY)` using a finite number of steps. In one **step**, you can move from point `(x, y)` to any one of the following points: `(x, y - x)` `(x - y, y)` `(2 * x, y)` `(x, 2 * y)` Given two integers `targetX` and `targetY` representing the X-coordinate and Y-coordinate of your final position, return `true` _if you can reach the point from_ `(1, 1)` _using some number of steps, and _`false`_ otherwise_. **Example 1:** ``` **Input:** targetX = 6, targetY = 9 **Output:** false **Explanation:** It is impossible to reach (6,9) from (1,1) using any sequence of moves, so false is returned. ``` **Example 2:** ``` **Input:** targetX = 4, targetY = 7 **Output:** true **Explanation:** You can follow the path (1,1) -> (1,2) -> (1,4) -> (1,8) -> (1,7) -> (2,7) -> (4,7). ``` **Constraints:** `1 <= targetX, targetY <= 109`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "targetX = 6, targetY = 9",12            "output": "false "13        },14        {15            "label": "Example 2",16            "input": "targetX = 4, targetY = 7",17            "output": "true "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                303660259,24                53798288125            ],26            "output": true27        },28        {29            "input": [30                382325806,31                73312097632            ],33            "output": true34        },35        {36            "input": [37                210576177,38                53028417939            ],40            "output": false41        },42        {43            "input": [44                577023801,45                85434526146            ],47            "output": true48        },49        {50            "input": [51                793570509,52                39188646953            ],54            "output": false55        },56        {57            "input": [58                336580977,59                48744123360            ],61            "output": false62        },63        {64            "input": [65                697974041,66                69773434967            ],68            "output": true69        },70        {71            "input": [72                596465905,73                1935310574            ],75            "output": false76        },77        {78            "input": [79                391568324,80                1328387181            ],82            "output": true83        },84        {85            "input": [86                102819043,87                98891050788            ],89            "output": true90        }91    ],92    "haskell_template": "isReachable :: Int -> Int -> Bool\nisReachable targetX targetY ",93    "ocaml_template": "let isReachable (targetX: int) (targetY: int) : bool =  ",94    "scala_template": "def isReachable(targetX: Int,targetY: Int): Boolean = { \n    \n}",95    "java_template": "class Solution {\n    public boolean isReachable(int targetX, int targetY) {\n        \n    }\n}",96    "python_template": "class Solution(object):\n    def isReachable(self, targetX, targetY):\n        \"\"\"\n        :type targetX: int\n        :type targetY: int\n        :rtype: bool\n        \"\"\"\n        "97}