Jump to content

Longest string challenge: Difference between revisions

m
underscored a restriction that appeared to be ignored by a majority of entries/implementations.
m (→‎read file until not ready: changed some comments and whitespace.)
m (underscored a restriction that appeared to be ignored by a majority of entries/implementations.)
Line 57:
 
* In general, the restrictions are meant to avoid the explicit use of these features.
* "No comparison operators may be used" - At some level there must be some test that allows the solution to get at the length and determine if one string is longer. Comparison operators, in particular any less/greater comparison should be avoided. <u>Representing the length of any string as a number should also be avoided.</u> Various approaches allow for detecting the end of a string. Some of these involve implicitly using equal/not-equal; however, explicitly using equal/not-equal should be acceptable.
* "No arithmetic operations" - Again, at some level something may have to advance through the string. Often there are ways a language can do this implicitly advance a cursor or pointer without explicitly using a +, - , ++, --, add, subtract, etc.
* The datatype restrictions are amongst the most difficult to reinterpret. In the language of the original challenge strings are atomic datatypes and structured datatypes like lists are quite distinct and have many different operations that apply to them. This becomes a bit fuzzier with languages with a different programming paradigm. The intent would be to avoid using an easy structure to accumulate the longest strings and spit them out. There will be some natural reinterpretation here.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.