Talk:Rep-string: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Inspiration: and clarification)
(→‎Clarification: Alternatively ...)
Line 1: Line 1:
==Inspiration==
==Inspiration==
The task was inspired by [http://stackoverflow.com/questions/16474895/finding-a-pattern-in-a-binary-string this question] on stackoverflow. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 19:45, 10 May 2013 (UTC)
The task was inspired by [http://stackoverflow.com/questions/16474895/finding-a-pattern-in-a-binary-string this question] on stackoverflow. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 19:45, 10 May 2013 (UTC)

: The task needs some clarifation. What is a repeat? Is string "10" itself repeated once? Is string "101" a repeat of "10"? When finding a repeated substring "if any", what's the preferred answer for "1111", is it "1" or "11", or even "111" and "1111"? There needs be a clear definition of the word "repeat", not just relying on whatever the first sample solution says, beause can be too arbitrary. --[[User:Ledrug|Ledrug]] ([[User talk:Ledrug|talk]]) 03:53, 12 May 2013 (UTC)
==Clarification==
The task needs some clarifation. What is a repeat? Is string "10" itself repeated once? Is string "101" a repeat of "10"? When finding a repeated substring "if any", what's the preferred answer for "1111", is it "1" or "11", or even "111" and "1111"? There needs be a clear definition of the word "repeat", not just relying on whatever the first sample solution says, beause can be too arbitrary. --[[User:Ledrug|Ledrug]] ([[User talk:Ledrug|talk]]) 03:53, 12 May 2013 (UTC)


:I think I was most sloppy about ''"a series of ones and zeroes in a string"'': I meant a series of ones ''or'' zeroes. .. Oh wait .. Re-reading your question, repeat means "two or more times" which is in the description.

:Alternatively:
:# Take a string of ones and zeroes X.
:# Find out if there is at least one string Y of ones and/or zeroes that when repeated and truncated on the right to the same length as X is both equal to X ''and'' contains at least two repetitions of Y.
:# If any valid Y is found then X is a rep-string.
:Hope this helps :-) --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 08:22, 12 May 2013 (UTC)

Revision as of 08:22, 12 May 2013

Inspiration

The task was inspired by this question on stackoverflow. --Paddy3118 (talk) 19:45, 10 May 2013 (UTC)

Clarification

The task needs some clarifation. What is a repeat? Is string "10" itself repeated once? Is string "101" a repeat of "10"? When finding a repeated substring "if any", what's the preferred answer for "1111", is it "1" or "11", or even "111" and "1111"? There needs be a clear definition of the word "repeat", not just relying on whatever the first sample solution says, beause can be too arbitrary. --Ledrug (talk) 03:53, 12 May 2013 (UTC)


I think I was most sloppy about "a series of ones and zeroes in a string": I meant a series of ones or zeroes. .. Oh wait .. Re-reading your question, repeat means "two or more times" which is in the description.
Alternatively:
  1. Take a string of ones and zeroes X.
  2. Find out if there is at least one string Y of ones and/or zeroes that when repeated and truncated on the right to the same length as X is both equal to X and contains at least two repetitions of Y.
  3. If any valid Y is found then X is a rep-string.
Hope this helps :-) --Paddy3118 (talk) 08:22, 12 May 2013 (UTC)