Problem 551. Have you seen any Spindromes recently?
- Never been to the dwarf planet makemake yet?
- Assume a new unexplored planet has several moons spinning around it,
- all on a flat circular orbit and equally spaced,
- and represented by a sequence of letters such as 'm a k e m a k e'
- or simply 'makemake'.
- Another example of a sequence of spinning moons could be '0 3 4 6 4 9'
- or simply '034649'.
- Notice that some moons may have same names.
- Assuming that such a sequence could also be called a spindrome if the spinning moons of same names can be distinguishable from each other by the neighbors.
- Otherwise that sequence is not a spindrome.
- The sequence 'makemake' is not a spindrome.
- The sequence '034649' is a spindrome.
- Please detect if the given sequence is a spindrome.
Solution Stats
Problem Comments
-
6 Comments
@Amitava: I think test cases 4 and 6 are incorrect. Could you please verify the same?
@Amitava: please ignore my previous comment. Cheers.
Cheers
Neighbors are more than adjacents. The first and last elements are considered adjacent. Thus [ABAABA] is not a spindrome as it becomes ...AABAABAA...
However [ABA] is a spindrome even though it also becomes ...AABAABAA...
can u be more clear about test suite 4 & 6?
The definition of spindromes is not really clear. But basically it seems that we must look if there is a repeating pattern, if we found one, then the sequence is not a spindrome. On the other hand, AAAXXXAAA should not be a spindrome imho, since it is a repeating pattern AAAXXXAAAAAAXXXAAAAAAXXXAAAAAAXXXAAA ... so we have to limit the test to half of the list size which means AAAXX | XAAA is apparently a spindrome. However BBBXXXBBBXXX is not a spindrome, since we would have BBBXXX | BBBXXX.
Solution Comments
Show commentsProblem Recent Solvers18
Suggested Problems
-
2988 Solvers
-
304 Solvers
-
448 Solvers
-
Project Euler: Problem 6, Natural numbers, squares and sums.
2139 Solvers
-
Wind outward from the center ...
83 Solvers
More from this Author100
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!