Problem 45425. The Tortoise and the Hare - 01
Suppose in an infinitely long line, the hare is standing in position 0.
From that place, it can jump either in the +ve direction or in the -ve [but not both].
One condition is that, in i-th jump, it can move i step. Meaning -
0 1 [1st step >> so 0+1] 3 [2nd step >> so 1+2] 6 10
Given a position x, determine whether the hare will be in that position or not.
For example,
if x=15 then true if x=14 then false.
Similar problem https://www.mathworks.com/matlabcentral/cody/problems/45347-cat-s-paw-01
Solution Stats
Problem Comments
-
2 Comments
why 14 is false?
'-1-2+3-4+5+6+7'?
if it starts going in the forward direction, it'll always move in that way.
The movement will be unidirectional
Solution Comments
Show commentsProblem Recent Solvers27
Suggested Problems
-
Calculate the Levenshtein distance between two strings
1421 Solvers
-
Create a cell array out of a struct
1769 Solvers
-
Project Euler: Problem 3, Largest prime factor
1404 Solvers
-
Recurring Cycle Length (Inspired by Project Euler Problem 26)
122 Solvers
-
Create a matrix X, where each column is a shifted copy of the vector v
201 Solvers
More from this Author165
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!